good morning!!!!

Skip to content
Snippets Groups Projects
Commit dc92779c authored by Martin Holst Swende's avatar Martin Holst Swende Committed by Felix Lange
Browse files

p2p: change ping ticker to timer (#15071)

Using a Timer over Ticker seems to be a lot better, though I cannot fully
account for why that it behaves so (since Ticker should be more bursty, but not
necessarily more active over time, but that may depend on how long window it
uses to decide on when to tick next)
parent d70536b5
No related branches found
No related tags found
No related merge requests found
......@@ -190,7 +190,7 @@ loop:
}
func (p *Peer) pingLoop() {
ping := time.NewTicker(pingInterval)
ping := time.NewTimer(pingInterval)
defer p.wg.Done()
defer ping.Stop()
for {
......@@ -200,6 +200,7 @@ func (p *Peer) pingLoop() {
p.protoErr <- err
return
}
ping.Reset(pingInterval)
case <-p.closed:
return
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment