Browse Source

consistent and explicit use of constant for devp2p protocol version

cl-refactor
subtly 10 years ago
parent
commit
6093170990
  1. 4
      libp2p/Host.cpp
  2. 2
      libp2p/NodeTable.cpp
  3. 2
      libp2p/NodeTable.h

4
libp2p/Host.cpp

@ -709,7 +709,7 @@ bytes Host::saveNetwork() const
}
RLPStream ret(3);
ret << c_protocolVersion << m_alias.secret();
ret << dev::p2p::c_protocolVersion << m_alias.secret();
ret.appendList(count).appendRaw(network.out(), count);
return ret.out();
}
@ -722,7 +722,7 @@ void Host::restoreNetwork(bytesConstRef _b)
RecursiveGuard l(x_sessions);
RLP r(_b);
if (r.itemCount() > 0 && r[0].isInt() && r[0].toInt<unsigned>() == c_protocolVersion)
if (r.itemCount() > 0 && r[0].isInt() && r[0].toInt<unsigned>() == dev::p2p::c_protocolVersion)
{
// r[0] = version
// r[1] = key

2
libp2p/NodeTable.cpp

@ -477,7 +477,7 @@ void NodeTable::onReceived(UDPSocketFace*, bi::udp::endpoint const& _from, bytes
case PingNode::type:
{
PingNode in = PingNode::fromBytesConstRef(_from, rlpBytes);
if (in.version != c_protocolVersion)
if (in.version != dev::p2p::c_protocolVersion)
{
if (auto n = nodeEntry(nodeid))
dropNode(n);

2
libp2p/NodeTable.h

@ -316,7 +316,7 @@ struct PingNode: RLPXDatagram<PingNode>
static const uint8_t type = 1;
unsigned version = c_protocolVersion;
unsigned version = dev::p2p::c_protocolVersion;
std::string ipAddress;
unsigned port;
unsigned expiration;

Loading…
Cancel
Save