Browse Source

fix magic. disable ping for now, as it can trigger prior to hello packet.

cl-refactor
subtly 10 years ago
parent
commit
ec4ba8e532
  1. 6
      libp2p/Host.cpp

6
libp2p/Host.cpp

@ -517,6 +517,7 @@ void Host::doHandshake(Handshake* _h, boost::system::error_code _ech)
k->egressMac.ref().copyTo(bytesConstRef(&k->magicCipherAndMac).cropped(k->magicCipherAndMac.size() - 32, 32)); k->egressMac.ref().copyTo(bytesConstRef(&k->magicCipherAndMac).cropped(k->magicCipherAndMac.size() - 32, 32));
clog(NetConnect) << "devp2p.connect.egress txrx magic sequence"; clog(NetConnect) << "devp2p.connect.egress txrx magic sequence";
k->recvdMagicCipherAndMac.resize(k->magicCipherAndMac.size());
ba::async_write(*_h->socket, ba::buffer(k->magicCipherAndMac), [this, k, _h, magic](boost::system::error_code ec, std::size_t) ba::async_write(*_h->socket, ba::buffer(k->magicCipherAndMac), [this, k, _h, magic](boost::system::error_code ec, std::size_t)
{ {
@ -543,7 +544,6 @@ void Host::doHandshake(Handshake* _h, boost::system::error_code _ech)
bytes decryptedMagic; bytes decryptedMagic;
decryptSymNoAuth(k->encryptK, h256(), &k->recvdMagicCipherAndMac, decryptedMagic); decryptSymNoAuth(k->encryptK, h256(), &k->recvdMagicCipherAndMac, decryptedMagic);
clog(NetNote) << "devp2p.connect received magic sequence";
shared_ptr<Peer> p; shared_ptr<Peer> p;
p = m_peers[_h->remote]; p = m_peers[_h->remote];
@ -716,8 +716,8 @@ void Host::run(boost::system::error_code const&)
if (auto pp = p.second.lock()) if (auto pp = p.second.lock())
pp->serviceNodesRequest(); pp->serviceNodesRequest();
keepAlivePeers(); // keepAlivePeers();
disconnectLatePeers(); // disconnectLatePeers();
auto c = peerCount(); auto c = peerCount();
if (m_idealPeerCount && !c) if (m_idealPeerCount && !c)

Loading…
Cancel
Save