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

Method startEventTimer

consensus/vbft/event_timer.go:193–213  ·  view source on GitHub ↗

internal helper, should call with lock held

(evtType TimerEventType, blockNum uint32)

Source from the content-addressed store, hash-verified

191// internal helper, should call with lock held
192//
193func (self *EventTimer) startEventTimer(evtType TimerEventType, blockNum uint32) error {
194 timers := self.eventTimers[evtType]
195 if t, present := timers[blockNum]; present {
196 t.Stop()
197 delete(timers, blockNum)
198 log.Infof("timer (type: %d) for %d got reset", evtType, blockNum)
199 }
200
201 timeout := self.getEventTimeout(evtType)
202 if timeout == 0 {
203 log.Errorf("invalid timeout for event %d, blkNum %d", evtType, blockNum)
204 return fmt.Errorf("invalid timeout for event %d, blkNum %d", evtType, blockNum)
205 }
206 timers[blockNum] = time.AfterFunc(timeout, func() {
207 self.C <- &TimerEvent{
208 evtType: evtType,
209 blockNum: blockNum,
210 }
211 })
212 return nil
213}
214
215//
216// internal helper, should call with lock held

Callers 11

StartProposalTimerMethod · 0.95
StartEndorsingTimerMethod · 0.95
StartCommitTimerMethod · 0.95
StartBackoffTimerMethod · 0.95
Start2ndProposalTimerMethod · 0.95
StartTxBlockTimeoutMethod · 0.95
startTxTickerMethod · 0.95
TestStartEventTimerFunction · 0.80
TestCancelEventTimerFunction · 0.80

Calls 5

getEventTimeoutMethod · 0.95
InfofFunction · 0.92
ErrorfFunction · 0.92
ErrorfMethod · 0.80
StopMethod · 0.65

Tested by 2

TestStartEventTimerFunction · 0.64
TestCancelEventTimerFunction · 0.64