aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2020-12-27 09:22:04 +0000
committerJohn Newbery <john@johnnewbery.com>2021-01-02 16:51:42 +0000
commit673254515a2f97e53dd8c7335c836b083ba7e31a (patch)
treeee0fec23e211d6605507688df15407a6173fdbf0
parent02cf20b9f571474c939d18a8b9d6b5d22479a222 (diff)
[net] Move RecordBytesSent() call out of cs_vSend lock
-rw-r--r--src/net.cpp14
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);