summaryrefslogtreecommitdiffhomepage
path: root/device/peer.go
diff options
context:
space:
mode:
Diffstat (limited to 'device/peer.go')
-rw-r--r--device/peer.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/device/peer.go b/device/peer.go
index 815dff4..4e7f2da 100644
--- a/device/peer.go
+++ b/device/peer.go
@@ -10,6 +10,7 @@ import (
"errors"
"fmt"
"sync"
+ "sync/atomic"
"time"
)
@@ -140,7 +141,11 @@ func (peer *Peer) SendBuffer(buffer []byte) error {
return errors.New("no known endpoint for peer")
}
- return peer.device.net.bind.Send(buffer, peer.endpoint)
+ err := peer.device.net.bind.Send(buffer, peer.endpoint)
+ if err == nil {
+ atomic.AddUint64(&peer.stats.txBytes, uint64(len(buffer)))
+ }
+ return err
}
func (peer *Peer) String() string {