diff options
author | John Newbery <john@johnnewbery.com> | 2020-12-27 09:22:04 +0000 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2021-01-02 16:51:42 +0000 |
commit | 673254515a2f97e53dd8c7335c836b083ba7e31a (patch) | |
tree | ee0fec23e211d6605507688df15407a6173fdbf0 /src/net.cpp | |
parent | 02cf20b9f571474c939d18a8b9d6b5d22479a222 (diff) |
[net] Move RecordBytesSent() call out of cs_vSend lock
Diffstat (limited to 'src/net.cpp')
-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); |