mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-10 15:46:48 -04:00
net: Log accepted connection after m_nodes.push_back
Otherwise, the debug log could read confusingly, when the getpeerinfo() RPC (calling GetNodeStats) happens after the "accepted connection" log line, but returns an empty list. For example, the following timeline in the debug log could correspond to a getpeerinfo reply that is empty: [net] [net.cpp:3764] [CNode] Added connection peer=0 [net] [net.cpp:1814] [CreateNodeFromAcceptedSocket] connection from 127.0.0.1:45154 accepted [http] [httpserver.cpp:305] [http_request_cb] Received a POST request for / from 127.0.0.1:33320 [httpworker.1] [rpc/request.cpp:232] [parse] ThreadRPCServer method=getpeerinfo user=__cookie__ Fix it by moving the log line.
This commit is contained in:
parent
910d38b22f
commit
55555574d1
1 changed files with 1 additions and 3 deletions
|
@ -1810,13 +1810,11 @@ void CConnman::CreateNodeFromAcceptedSocket(std::unique_ptr<Sock>&& sock,
|
|||
});
|
||||
pnode->AddRef();
|
||||
m_msgproc->InitializeNode(*pnode, nLocalServices);
|
||||
|
||||
LogPrint(BCLog::NET, "connection from %s accepted\n", addr.ToStringAddrPort());
|
||||
|
||||
{
|
||||
LOCK(m_nodes_mutex);
|
||||
m_nodes.push_back(pnode);
|
||||
}
|
||||
LogDebug(BCLog::NET, "connection from %s accepted\n", addr.ToStringAddrPort());
|
||||
|
||||
// We received a new connection, harvest entropy from the time (and our peer count)
|
||||
RandAddEvent((uint32_t)id);
|
||||
|
|
Loading…
Add table
Reference in a new issue