Browse Source

update last disconnect for fallback timer after successful connect.

cl-refactor
subtly 10 years ago
parent
commit
c60b0099c7
  1. 3
      libp2p/Host.cpp
  2. 8
      libp2p/Session.cpp

3
libp2p/Host.cpp

@ -467,8 +467,9 @@ void Host::connect(std::shared_ptr<Peer> const& _p)
else
{
clog(NetConnect) << "Connected to" << _p->id.abridged() << "@" << _p->peerEndpoint();
_p->m_lastDisconnect = NoDisconnect;
_p->m_lastConnected = std::chrono::system_clock::now();
_p->m_failedAttempts = 0;
auto ps = make_shared<Session>(this, std::move(*s), _p);
ps->start();

8
libp2p/Session.cpp

@ -193,8 +193,12 @@ bool Session::interpret(RLP const& _r)
}
else if (m_peer->id != id)
{
disconnect(UnexpectedIdentity);
return true;
// TODO p2p: FIXME. Host should catch this and reattempt adding node to table.
m_peer->id = id;
m_peer->m_score = 0;
m_peer->m_rating = 0;
// disconnect(UnexpectedIdentity);
// return true;
}
if (m_server->havePeerSession(id))

Loading…
Cancel
Save