switch.go
func (sw *Switch) OnStart() error {
	sw.BaseService.OnStart()
	// Start reactors
	for _, reactor := range sw.reactors {
		_, err := reactor.Start()
		if err != nil {
			return err
		}
	}
	// Start peers
	for _, peer := range sw.peers.List() {
		sw.startInitPeer(peer)
	}
	// Start listeners
	for _, listener := range sw.listeners {
		go sw.listenerRoutine(listener)
	}
	return nil
}
func (sw *Switch) OnStart() error {
	sw.BaseService.OnStart()
	// Start reactors
	for _, reactor := range sw.reactors {
		_, err := reactor.Start()
		if err != nil {
			return err
		}
	}
	// Start peers
	for _, peer := range sw.peers.List() {
		sw.startInitPeer(peer)
	}
	// Start listeners
	for _, listener := range sw.listeners {
		go sw.listenerRoutine(listener)
	}
	return nil
}
func ( sw * Switch ) OnStart ( ) error { sw . BaseService . OnStart ( ) // Start reactors for _ , reactor := range sw . reactors { _ , err := reactor . Start ( ) if err != nil { return err } } // Start peers for _ , peer := range sw . peers . List ( ) { sw . startInitPeer ( peer ) } // Start listeners for _ , listener := range sw . listeners { go sw . listenerRoutine ( listener ) } return nil }
// Switch.Start() starts all the reactors, peers, and listeners.
Switch . Start () starts all the reactors peers and listeners .