Don't report pkt7 losses

This commit is contained in:
Nonoo 2020-10-25 16:39:16 +01:00
parent 3d4925c2c7
commit bd5f210dd4

28
pkt7.go
View file

@ -6,8 +6,6 @@ import (
"encoding/binary" "encoding/binary"
"errors" "errors"
"time" "time"
"github.com/nonoo/kappanhang/log"
) )
const pkt7TimeoutDuration = 3 * time.Second const pkt7TimeoutDuration = 3 * time.Second
@ -15,7 +13,7 @@ const pkt7TimeoutDuration = 3 * time.Second
type pkt7Type struct { type pkt7Type struct {
sendSeq uint16 sendSeq uint16
innerSendSeq uint16 innerSendSeq uint16
lastConfirmedSeq uint16 // lastConfirmedSeq uint16
sendTicker *time.Ticker sendTicker *time.Ticker
timeoutTimer *time.Timer timeoutTimer *time.Timer
@ -53,17 +51,17 @@ func (p *pkt7Type) handle(s *streamCommon, r []byte) error {
p.latency /= 2 p.latency /= 2
} }
expectedSeq := p.lastConfirmedSeq + 1 // expectedSeq := p.lastConfirmedSeq + 1
if expectedSeq != gotSeq && gotSeq != p.lastConfirmedSeq { // if expectedSeq != gotSeq && gotSeq != p.lastConfirmedSeq {
var missingPkts int // var missingPkts int
if gotSeq > expectedSeq { // if gotSeq > expectedSeq {
missingPkts = int(gotSeq) - int(expectedSeq) // missingPkts = int(gotSeq) - int(expectedSeq)
} else { // } else {
missingPkts = int(gotSeq) + 65536 - int(expectedSeq) // missingPkts = int(gotSeq) + 65536 - int(expectedSeq)
} // }
log.Error(s.name+"/lost ", missingPkts, " packets") // log.Error(s.name+"/lost ", missingPkts, " packets")
} // }
p.lastConfirmedSeq = gotSeq // p.lastConfirmedSeq = gotSeq
} }
return nil return nil
} }
@ -141,7 +139,7 @@ func (p *pkt7Type) loop(s *streamCommon) {
func (p *pkt7Type) startPeriodicSend(s *streamCommon, firstSeqNo uint16, checkPingTimeout bool) { func (p *pkt7Type) startPeriodicSend(s *streamCommon, firstSeqNo uint16, checkPingTimeout bool) {
p.sendSeq = firstSeqNo p.sendSeq = firstSeqNo
p.innerSendSeq = 0x8304 p.innerSendSeq = 0x8304
p.lastConfirmedSeq = p.sendSeq - 1 // p.lastConfirmedSeq = p.sendSeq - 1
p.sendTicker = time.NewTicker(100 * time.Millisecond) p.sendTicker = time.NewTicker(100 * time.Millisecond)
if checkPingTimeout { if checkPingTimeout {