Browse Source

Merge pull request #1622 from ethereum/p2p

restore setting socketid for logging
cl-refactor
Gav Wood 10 years ago
parent
commit
a8b6e2b5d4
  1. 2
      libp2p/Common.h
  2. 1
      libp2p/Session.cpp
  3. 2
      libp2p/Session.h

2
libp2p/Common.h

@ -145,7 +145,7 @@ struct PeerSessionInfo
unsigned short port;
std::chrono::steady_clock::duration lastPing;
std::set<CapDesc> caps;
unsigned socket;
unsigned socketId;
std::map<std::string, std::string> notes;
};

1
libp2p/Session.cpp

@ -48,6 +48,7 @@ Session::Session(Host* _s, RLPXFrameIO* _io, std::shared_ptr<Peer> const& _n, Pe
{
m_peer->m_lastDisconnect = NoDisconnect;
m_lastReceived = m_connect = chrono::steady_clock::now();
m_info.socketId = _io->socket().native_handle();
}
Session::~Session()

2
libp2p/Session.h

@ -65,7 +65,7 @@ public:
bool isConnected() const { return m_socket.is_open(); }
NodeId id() const;
unsigned socketId() const { return m_info.socket; }
unsigned socketId() const { return m_info.socketId; }
template <class PeerCap>
std::shared_ptr<PeerCap> cap() const { try { return std::static_pointer_cast<PeerCap>(m_capabilities.at(std::make_pair(PeerCap::name(), PeerCap::version()))); } catch (...) { return nullptr; } }

Loading…
Cancel
Save