|
|
@ -182,10 +182,8 @@ void Host::startPeerSession(Public const& _id, RLP const& _rlp, RLPXFrameIO* _io |
|
|
|
} |
|
|
|
else |
|
|
|
p = m_peers[_id]; |
|
|
|
p->m_lastDisconnect = NoDisconnect; |
|
|
|
if (p->isOffline()) |
|
|
|
p->m_lastConnected = std::chrono::system_clock::now(); |
|
|
|
p->m_failedAttempts = 0; |
|
|
|
p->endpoint.tcp.address(_endpoint.address()); |
|
|
|
|
|
|
|
auto protocolVersion = _rlp[0].toInt<unsigned>(); |
|
|
@ -484,12 +482,14 @@ void Host::connect(std::shared_ptr<Peer> const& _p) |
|
|
|
auto socket = make_shared<RLPXSocket>(new bi::tcp::socket(m_ioService)); |
|
|
|
socket->ref().async_connect(_p->peerEndpoint(), [=](boost::system::error_code const& ec) |
|
|
|
{ |
|
|
|
_p->m_lastAttempted = std::chrono::system_clock::now(); |
|
|
|
_p->m_failedAttempts++; |
|
|
|
|
|
|
|
if (ec) |
|
|
|
{ |
|
|
|
clog(NetConnect) << "Connection refused to node" << _p->id.abridged() << "@" << _p->peerEndpoint() << "(" << ec.message() << ")"; |
|
|
|
// Manually set error (session not present)
|
|
|
|
_p->m_lastDisconnect = TCPError; |
|
|
|
_p->m_lastAttempted = std::chrono::system_clock::now(); |
|
|
|
_p->m_failedAttempts++; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
@ -499,9 +499,7 @@ void Host::connect(std::shared_ptr<Peer> const& _p) |
|
|
|
Guard l(x_connecting); |
|
|
|
m_connecting.push_back(handshake); |
|
|
|
} |
|
|
|
|
|
|
|
// preempt setting failedAttempts; this value is cleared upon success
|
|
|
|
_p->m_failedAttempts++; |
|
|
|
|
|
|
|
handshake->start(); |
|
|
|
} |
|
|
|
|
|
|
|