Skip to content

Commit e01b9e7

Browse files
authored
network: count received traffic before decompression (#6330)
1 parent ad67b95 commit e01b9e7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

network/wsPeer.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -590,11 +590,6 @@ func (wp *wsPeer) readLoop() {
590590
msg.processing = wp.processed
591591
msg.Received = time.Now().UnixNano()
592592
msg.Data = slurper.Bytes()
593-
msg.Data, err = dataConverter.convert(msg.Tag, msg.Data)
594-
if err != nil {
595-
wp.reportReadErr(err)
596-
return
597-
}
598593
msg.Net = wp.net
599594
wp.lastPacketTime.Store(msg.Received)
600595
if wp.peerType == peerTypeWs {
@@ -608,6 +603,11 @@ func (wp *wsPeer) readLoop() {
608603
networkP2PReceivedBytesByTag.Add(string(tag[:]), uint64(len(msg.Data)+2))
609604
networkP2PMessageReceivedByTag.Add(string(tag[:]), 1)
610605
}
606+
msg.Data, err = dataConverter.convert(msg.Tag, msg.Data)
607+
if err != nil {
608+
wp.reportReadErr(err)
609+
return
610+
}
611611
msg.Sender = wp
612612

613613
// for outgoing connections, we want to notify the connection monitor that we've received

0 commit comments

Comments
 (0)