Browse Source

Merge pull request #1417 from ethereum/p2p

Fix segfault when using upnp and increase handshake timeout
cl-refactor
Gav Wood 10 years ago
parent
commit
470f4b367e
  1. 2
      libp2p/RLPxHandshake.h
  2. 9
      libp2p/UDP.h

2
libp2p/RLPxHandshake.h

@ -95,7 +95,7 @@ protected:
void transition(boost::system::error_code _ech = boost::system::error_code());
/// Timeout for remote to respond to transition events. Enforced by m_idleTimer and refreshed by transition().
boost::posix_time::milliseconds const c_timeout = boost::posix_time::milliseconds(1000);
boost::posix_time::milliseconds const c_timeout = boost::posix_time::milliseconds(1800);
State m_nextState = New; ///< Current or expected state of transition.
bool m_cancel = false; ///< Will be set to true if connection was canceled.

9
libp2p/UDP.h

@ -163,7 +163,14 @@ void UDPSocket<Handler, MaxDatagramSize>::connect()
return;
m_socket.open(bi::udp::v4());
m_socket.bind(m_endpoint);
try
{
m_socket.bind(m_endpoint);
}
catch (...)
{
m_socket.bind(bi::udp::endpoint(bi::udp::v4(), m_endpoint.port()));
}
// clear write queue so reconnect doesn't send stale messages
Guard l(x_sendQ);

Loading…
Cancel
Save