MCPcopy Create free account
hub / github.com/DNAProject/DNA / startPeerTicker

Method startPeerTicker

consensus/vbft/event_timer.go:353–372  ·  view source on GitHub ↗
(peerIdx uint32)

Source from the content-addressed store, hash-verified

351}
352
353func (self *EventTimer) startPeerTicker(peerIdx uint32) error {
354 self.lock.Lock()
355 defer self.lock.Unlock()
356
357 if p, present := self.peerTickers[peerIdx]; present {
358 p.Stop()
359 log.Infof("ticker for %d got reset", peerIdx)
360 }
361
362 timeout := self.getEventTimeout(EventPeerHeartbeat)
363 self.peerTickers[peerIdx] = time.AfterFunc(timeout, func() {
364 self.C <- &TimerEvent{
365 evtType: EventPeerHeartbeat,
366 blockNum: peerIdx,
367 }
368 self.peerTickers[peerIdx].Reset(timeout)
369 })
370
371 return nil
372}
373
374func (self *EventTimer) stopPeerTicker(peerIdx uint32) error {
375 self.lock.Lock()

Callers 1

startMethod · 0.80

Calls 4

getEventTimeoutMethod · 0.95
InfofFunction · 0.92
StopMethod · 0.65
ResetMethod · 0.45

Tested by

no test coverage detected