]> Sergey Matveev's repositories - vors.git/blobdiff - cmd/client/main.go
Consider overhead length in statistics
[vors.git] / cmd / client / main.go
index 71fe10fda05b975e940ef0ad0ad93ffef70ee616f8baeae23f40f02c7e8fd228..c745deae7edb5fe17c921ab932581fbe2b82272e6b8b64b13b6fe9d44e6443fa 100644 (file)
@@ -501,7 +501,7 @@ func main() {
                                continue
                        }
                        stream.stats.pkts++
-                       stream.stats.bytes += uint64(n)
+                       stream.stats.bytes += vors.IPHdrLen(from.IP) + 8 + uint64(n)
                        ctr = binary.BigEndian.Uint32(buf)
                        if ctr <= stream.ctr {
                                stream.stats.reorder++
@@ -519,7 +519,7 @@ func main() {
                                continue
                        }
                        OurStats.pkts++
-                       OurStats.bytes += 1
+                       OurStats.bytes += vors.IPHdrLen(srvAddrUDP.IP) + 8 + 1
                        if _, err = conn.Write([]byte{sid}); err != nil {
                                log.Println("send:", err)
                                Finish <- struct{}{}
@@ -584,7 +584,7 @@ func main() {
                        pkt = buf[:4+n+vors.TagLen]
 
                        OurStats.pkts++
-                       OurStats.bytes += uint64(len(pkt))
+                       OurStats.bytes += vors.IPHdrLen(srvAddrUDP.IP) + 8 + uint64(len(pkt))
                        OurStats.last = time.Now()
                        OurStats.AddRMS(pcm)
                        if _, err = conn.Write(pkt); err != nil {