// OnStart starts separate go routines for each p2p Channel and listens for
// envelopes on each. In addition, it also listens for peer updates and handles
// messages on that p2p channel accordingly. The caller must be sure to execute
// OnStop to ensure the outbound p2p Channels are closed.
OnStart starts separate go routines for each p2p Channel and listens for
envelopes on each. In addition, it also listens for peer updates and handles
messages on that p2p channel accordingly. The caller must be sure to execute
OnStop to ensure the outbound p2p Channels are closed.
// OnStart starts separate go routines for each p2p Channel and listens for // envelopes on each . In addition it also listens for peer updates and handles // messages on that p2p channel accordingly . The caller must be sure to execute // OnStop to ensure the outbound p2p Channels are closed .
func (r *Reactor) OnStart() error {
	r.Logger.Debug("consensus wait sync", "wait_sync", r.WaitSync())
	 TODO: Evaluate if we need this to be synchronized via WaitGroup as to not
	 leak the goroutine when stopping the reactor.
	go r.peerStatsRoutine()
	r.subscribeToBroadcastEvents()
	if !r.WaitSync() {
		if err := r.state.Start(); err != nil {
			return err
		}
	}
	go r.processStateCh()
	go r.processDataCh()
	go r.processVoteCh()
	go r.processVoteSetBitsCh()
	go r.processPeerUpdates()
	return nil
}
func ( r * Reactor ) OnStart ( ) error { r . Logger . Debug ( " " , " " , r . WaitSync ( ) ) go r . peerStatsRoutine ( ) r . subscribeToBroadcastEvents ( ) if ! r . WaitSync ( ) { if err := r . state . Start ( ) ; err != nil { return err } } go r . processStateCh ( ) go r . processDataCh ( ) go r . processVoteCh ( ) go r . processVoteSetBitsCh ( ) go r . processPeerUpdates ( ) return nil }
OnStart starts separate go routines for each p2p Channel and listens for
envelopes on each.
OnStart starts separate go routines for each p2p Channel and listens for envelopes on each .
// start routine that computes peer statistics for evaluating peer quality // // TODO: Evaluate if we need this to be synchronized via WaitGroup as to not // leak the goroutine when stopping the reactor.