diff options
-rw-r--r-- | src/net.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/net.cpp b/src/net.cpp index 7df0d11d37..3b1c19f60a 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1512,16 +1512,10 @@ void CConnman::SocketHandler() } } - // - // Send - // - if (sendSet) - { - LOCK(pnode->cs_vSend); - size_t nBytes = SocketSendData(pnode); - if (nBytes) { - RecordBytesSent(nBytes); - } + if (sendSet) { + // Send data + size_t bytes_sent = WITH_LOCK(pnode->cs_vSend, return SocketSendData(pnode)); + if (bytes_sent) RecordBytesSent(bytes_sent); } InactivityCheck(pnode); |