VirtualPacketConn: New Stats field maintained by caller. This allows insight into active transfers.

New FileTransferStats and BlockTransferStats structures.
This commit is contained in:
Kleissner
2022-03-16 23:52:55 +01:00
parent 51336263f5
commit cb1441c97a
8 changed files with 88 additions and 35 deletions

View File

@@ -423,9 +423,9 @@ func (nets *Networks) packetWorkerLite() {
// Handle the received data. Note this is called in the same Go routine.
// The underlying data receiver must not stall.
if v, ok := packet.Session.Data.(*virtualPacketConn); ok {
if v, ok := packet.Session.Data.(*VirtualPacketConn); ok {
// update stats TODO
//atomic.AddUint64(&packet.Session.Data.(*virtualPacketConn).peer.StatsPacketReceived, 1)
//atomic.AddUint64(&packet.Session.Data.(*VirtualPacketConn).peer.StatsPacketReceived, 1)
//connection.LastPacketIn = time.Now()
v.receiveData(packet.Payload)