|
|
|
@ -45,19 +45,29 @@ namespace transport
@@ -45,19 +45,29 @@ namespace transport
|
|
|
|
|
|
|
|
|
|
void SSUServer::OpenSocket () |
|
|
|
|
{ |
|
|
|
|
m_Socket.open (boost::asio::ip::udp::v4()); |
|
|
|
|
m_Socket.set_option (boost::asio::socket_base::receive_buffer_size (SSU_SOCKET_RECEIVE_BUFFER_SIZE)); |
|
|
|
|
m_Socket.set_option (boost::asio::socket_base::send_buffer_size (SSU_SOCKET_SEND_BUFFER_SIZE)); |
|
|
|
|
m_Socket.bind (m_Endpoint); |
|
|
|
|
try { |
|
|
|
|
m_Socket.open (boost::asio::ip::udp::v4()); |
|
|
|
|
m_Socket.set_option (boost::asio::socket_base::receive_buffer_size (SSU_SOCKET_RECEIVE_BUFFER_SIZE)); |
|
|
|
|
m_Socket.set_option (boost::asio::socket_base::send_buffer_size (SSU_SOCKET_SEND_BUFFER_SIZE)); |
|
|
|
|
m_Socket.bind (m_Endpoint); |
|
|
|
|
LogPrint (eLogInfo, "SSU: Start listening v4 port ", m_Endpoint.port()); |
|
|
|
|
} catch ( std::exception & ex ) { |
|
|
|
|
LogPrint (eLogError, "SSU: failed to bind to v4 port ", m_Endpoint.port(), ": ", ex.what()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SSUServer::OpenSocketV6 () |
|
|
|
|
{ |
|
|
|
|
m_SocketV6.open (boost::asio::ip::udp::v6()); |
|
|
|
|
m_SocketV6.set_option (boost::asio::ip::v6_only (true)); |
|
|
|
|
m_SocketV6.set_option (boost::asio::socket_base::receive_buffer_size (SSU_SOCKET_RECEIVE_BUFFER_SIZE)); |
|
|
|
|
m_SocketV6.set_option (boost::asio::socket_base::send_buffer_size (SSU_SOCKET_SEND_BUFFER_SIZE)); |
|
|
|
|
m_SocketV6.bind (m_EndpointV6); |
|
|
|
|
try { |
|
|
|
|
m_SocketV6.open (boost::asio::ip::udp::v6()); |
|
|
|
|
m_SocketV6.set_option (boost::asio::ip::v6_only (true)); |
|
|
|
|
m_SocketV6.set_option (boost::asio::socket_base::receive_buffer_size (SSU_SOCKET_RECEIVE_BUFFER_SIZE)); |
|
|
|
|
m_SocketV6.set_option (boost::asio::socket_base::send_buffer_size (SSU_SOCKET_SEND_BUFFER_SIZE)); |
|
|
|
|
m_SocketV6.bind (m_EndpointV6); |
|
|
|
|
LogPrint (eLogInfo, "SSU: Start listening v6 port ", m_EndpointV6.port()); |
|
|
|
|
} catch ( std::exception & ex ) { |
|
|
|
|
LogPrint (eLogError, "SSU: failed to bind to v6 port ", m_EndpointV6.port(), ": ", ex.what()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SSUServer::Start () |
|
|
|
|