Reduce pkt7 send interval

This commit is contained in:
Nonoo 2020-10-29 17:38:51 +01:00
parent 139d4010ee
commit c2b48b8ea0
2 changed files with 9 additions and 5 deletions

View file

@ -8,6 +8,9 @@ import (
"time"
)
// This is sent every 100ms by the server, but as this seems to be only a ping-line packet,
// it is also fine to send it in a longer interval.
const pkt7SendInterval = 3 * time.Second
const pkt7TimeoutDuration = 3 * time.Second
type pkt7Type struct {
@ -145,7 +148,7 @@ func (p *pkt7Type) startPeriodicSend(s *streamCommon, firstSeqNo uint16, checkPi
p.innerSendSeq = 0x8304
// p.lastConfirmedSeq = p.sendSeq - 1
p.sendTicker = time.NewTicker(100 * time.Millisecond)
p.sendTicker = time.NewTicker(pkt7SendInterval)
if checkPingTimeout {
p.timeoutTimer = time.NewTimer(pkt7TimeoutDuration)
}

View file

@ -19,8 +19,8 @@ type statusLogData struct {
mode string
filter string
startTime time.Time
rttLatency time.Duration
startTime time.Time
rttStr string
}
type statusLogStruct struct {
@ -53,7 +53,7 @@ func (s *statusLogStruct) reportRTTLatency(l time.Duration) {
if s.data == nil {
return
}
s.data.rttLatency = l
s.data.rttStr = fmt.Sprint(l.Milliseconds())
}
func (s *statusLogStruct) reportFrequency(f float64) {
@ -144,7 +144,7 @@ func (s *statusLogStruct) update() {
}
s.data.line2 = fmt.Sprint("up ", time.Since(s.data.startTime).Round(time.Second),
" rtt ", s.data.rttLatency.Milliseconds(), "ms up ",
" rtt ", s.data.rttStr, "ms up ",
netstat.formatByteCount(up), "/s down ",
netstat.formatByteCount(down), "/s retx ", retransmitsStr, "/1m lost ", lostStr, "/1m\r")
@ -195,6 +195,7 @@ func (s *statusLogStruct) startPeriodicPrint() {
s.data = &statusLogData{
stateStr: s.preGenerated.stateStr.unknown,
startTime: time.Now(),
rttStr: "?",
}
s.stopChan = make(chan bool)