Commit faae6ca
MarcoFalke
net: RecordBytesSent under cs_vSend lock
The CNode member nSendBytes is incremented under the node's lock
cs_vSend. However, RecordBytesSent is not. An RPC thread that acquires
the cs_vSend lock puts the message handler thread on hold. While the
thread is on hold, getnettotals returns "stale" values or values that
don't add up.
This can be fixed by making cs_vSend a "write lock" for the total bytes
sent in connman.
After this commit, both calls to RecordBytesSent are done under the
LOCK(pnode->cs_vSend);1 parent 8da1e43 commit faae6ca
1 file changed
+5
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1424 | 1424 | | |
1425 | 1425 | | |
1426 | 1426 | | |
1427 | | - | |
1428 | | - | |
| 1427 | + | |
1429 | 1428 | | |
1430 | 1429 | | |
1431 | 1430 | | |
| |||
2744 | 2743 | | |
2745 | 2744 | | |
2746 | 2745 | | |
2747 | | - | |
2748 | 2746 | | |
2749 | 2747 | | |
2750 | 2748 | | |
| |||
2760 | 2758 | | |
2761 | 2759 | | |
2762 | 2760 | | |
2763 | | - | |
2764 | | - | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
2765 | 2765 | | |
2766 | | - | |
2767 | | - | |
2768 | 2766 | | |
2769 | 2767 | | |
2770 | 2768 | | |
| |||
0 commit comments