mirror of
https://github.com/nonoo/kappanhang.git
synced 2026-02-20 14:34:26 +01:00
Reduce pkt7 send interval
This commit is contained in:
parent
139d4010ee
commit
c2b48b8ea0
5
pkt7.go
5
pkt7.go
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue