Browse Source

Fallback to 0.0.0.0 if bind fails. Bump handshake timeout until we switch back to secp256k1.

cl-refactor
subtly 10 years ago
parent
commit
1cb510dbd0
  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()); 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(). /// 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. State m_nextState = New; ///< Current or expected state of transition.
bool m_cancel = false; ///< Will be set to true if connection was canceled. 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; return;
m_socket.open(bi::udp::v4()); 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 // clear write queue so reconnect doesn't send stale messages
Guard l(x_sendQ); Guard l(x_sendQ);

Loading…
Cancel
Save