Browse Source

[ssu2] close socket if it was opened on OpenSocket

Signed-off-by: R4SAS <r4sas@i2pmail.org>
pull/1879/head
R4SAS 2 years ago
parent
commit
3c65012a63
Signed by: r4sas
GPG Key ID: 66F6C87B98EBCFE2
  1. 2
      libi2pd/SSU2.cpp

2
libi2pd/SSU2.cpp

@ -212,6 +212,8 @@ namespace transport
boost::asio::ip::udp::socket& socket = localEndpoint.address ().is_v6 () ? m_SocketV6 : m_SocketV4; boost::asio::ip::udp::socket& socket = localEndpoint.address ().is_v6 () ? m_SocketV6 : m_SocketV4;
try try
{ {
if (socket.is_open ())
socket.close ();
socket.open (localEndpoint.protocol ()); socket.open (localEndpoint.protocol ());
if (localEndpoint.address ().is_v6 ()) if (localEndpoint.address ().is_v6 ())
socket.set_option (boost::asio::ip::v6_only (true)); socket.set_option (boost::asio::ip::v6_only (true));

Loading…
Cancel
Save