|
@ -48,7 +48,8 @@ Session::Session(Host* _s, RLPXFrameIO* _io, std::shared_ptr<Peer> const& _n, Pe |
|
|
|
|
|
|
|
|
Session::~Session() |
|
|
Session::~Session() |
|
|
{ |
|
|
{ |
|
|
clog(NetMessageSummary) << "Closing Peer Session :-("; |
|
|
ThreadContext tc(info().id.abridged() + " | " + info().clientVersion); |
|
|
|
|
|
clog(NetMessageSummary) << "Closing peer session :-("; |
|
|
m_peer->m_lastConnected = m_peer->m_lastAttempted - chrono::seconds(1); |
|
|
m_peer->m_lastConnected = m_peer->m_lastAttempted - chrono::seconds(1); |
|
|
|
|
|
|
|
|
// Read-chain finished for one reason or another.
|
|
|
// Read-chain finished for one reason or another.
|
|
@ -116,6 +117,8 @@ void Session::ensureNodesRequested() |
|
|
|
|
|
|
|
|
void Session::serviceNodesRequest() |
|
|
void Session::serviceNodesRequest() |
|
|
{ |
|
|
{ |
|
|
|
|
|
ThreadContext tc(info().id.abridged() + "/" + info().clientVersion); |
|
|
|
|
|
|
|
|
if (!m_theyRequestedNodes) |
|
|
if (!m_theyRequestedNodes) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
@ -320,6 +323,7 @@ void Session::write() |
|
|
auto self(shared_from_this()); |
|
|
auto self(shared_from_this()); |
|
|
ba::async_write(m_socket, ba::buffer(bytes), [this, self](boost::system::error_code ec, std::size_t /*length*/) |
|
|
ba::async_write(m_socket, ba::buffer(bytes), [this, self](boost::system::error_code ec, std::size_t /*length*/) |
|
|
{ |
|
|
{ |
|
|
|
|
|
ThreadContext tc(info().id.abridged() + " | " + info().clientVersion); |
|
|
// must check queue, as write callback can occur following dropped()
|
|
|
// must check queue, as write callback can occur following dropped()
|
|
|
if (ec) |
|
|
if (ec) |
|
|
{ |
|
|
{ |
|
@ -393,7 +397,7 @@ void Session::doRead() |
|
|
auto self(shared_from_this()); |
|
|
auto self(shared_from_this()); |
|
|
ba::async_read(m_socket, boost::asio::buffer(m_data, h256::size), [this,self](boost::system::error_code ec, std::size_t length) |
|
|
ba::async_read(m_socket, boost::asio::buffer(m_data, h256::size), [this,self](boost::system::error_code ec, std::size_t length) |
|
|
{ |
|
|
{ |
|
|
ThreadContext tc(toString(socketId())); |
|
|
ThreadContext tc(info().id.abridged() + " | " + info().clientVersion); |
|
|
if (ec && ec.category() != boost::asio::error::get_misc_category() && ec.value() != boost::asio::error::eof) |
|
|
if (ec && ec.category() != boost::asio::error::get_misc_category() && ec.value() != boost::asio::error::eof) |
|
|
{ |
|
|
{ |
|
|
clog(NetWarn) << "Error reading: " << ec.message(); |
|
|
clog(NetWarn) << "Error reading: " << ec.message(); |
|
@ -429,8 +433,7 @@ void Session::doRead() |
|
|
auto tlen = frameSize + ((16 - (frameSize % 16)) % 16) + h128::size; |
|
|
auto tlen = frameSize + ((16 - (frameSize % 16)) % 16) + h128::size; |
|
|
ba::async_read(m_socket, boost::asio::buffer(m_data, tlen), [this, self, headerRLP, frameSize, tlen](boost::system::error_code ec, std::size_t length) |
|
|
ba::async_read(m_socket, boost::asio::buffer(m_data, tlen), [this, self, headerRLP, frameSize, tlen](boost::system::error_code ec, std::size_t length) |
|
|
{ |
|
|
{ |
|
|
ThreadContext tc1(toString(socketId())); |
|
|
ThreadContext tc(info().id.abridged() + " | " + info().clientVersion); |
|
|
ThreadContext tc2(toString(info().clientVersion)); |
|
|
|
|
|
if (ec && ec.category() != boost::asio::error::get_misc_category() && ec.value() != boost::asio::error::eof) |
|
|
if (ec && ec.category() != boost::asio::error::get_misc_category() && ec.value() != boost::asio::error::eof) |
|
|
{ |
|
|
{ |
|
|
clog(NetWarn) << "Error reading: " << ec.message(); |
|
|
clog(NetWarn) << "Error reading: " << ec.message(); |
|
|