Skip to content

Commit 6732545

Browse files
committed
[net] Move RecordBytesSent() call out of cs_vSend lock
1 parent 02cf20b commit 6732545

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/net.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,16 +1512,10 @@ void CConnman::SocketHandler()
15121512
}
15131513
}
15141514

1515-
//
1516-
// Send
1517-
//
1518-
if (sendSet)
1519-
{
1520-
LOCK(pnode->cs_vSend);
1521-
size_t nBytes = SocketSendData(pnode);
1522-
if (nBytes) {
1523-
RecordBytesSent(nBytes);
1524-
}
1515+
if (sendSet) {
1516+
// Send data
1517+
size_t bytes_sent = WITH_LOCK(pnode->cs_vSend, return SocketSendData(pnode));
1518+
if (bytes_sent) RecordBytesSent(bytes_sent);
15251519
}
15261520

15271521
InactivityCheck(pnode);

0 commit comments

Comments
 (0)