client: fix BytesSent / BytesReceived computation (#612) (#654)

When the TCP transport protocol is in use, BytesSent and BytesReceived
were increased twice.
This commit is contained in:
Alessandro Ros
2024-12-13 20:55:50 +01:00
committed by GitHub
parent 51f00fa828
commit a2df9d83b3
6 changed files with 43 additions and 15 deletions

View File

@@ -7,6 +7,7 @@ import (
"net"
"strings"
"sync"
"sync/atomic"
"testing"
"time"
@@ -334,6 +335,12 @@ func TestClientRecordSerial(t *testing.T) {
require.NoError(t, err)
<-recvDone
require.Greater(t, atomic.LoadUint64(c.BytesSent), uint64(730))
require.Less(t, atomic.LoadUint64(c.BytesSent), uint64(760))
require.Greater(t, atomic.LoadUint64(c.BytesReceived), uint64(180))
require.Less(t, atomic.LoadUint64(c.BytesReceived), uint64(210))
c.Close()
<-done