code: func (a *Agent) eventLoop() {
  	serfShutdownCh := a.serf.ShutdownCh()
  	for {
  		select {
  		case e := <-a.eventCh:
  			a.logger.Printf("[INFO] agent: Received event: %s", e.String())
  			a.eventHandlersLock.Lock()
  			handlers := a.eventHandlerList
  			a.eventHandlersLock.Unlock()
  			for _, eh := range handlers {
  				eh.HandleEvent(e)
  			}
  
  		case <-serfShutdownCh:
  			a.logger.Printf("[WARN] agent: Serf shutdown detected, quitting")
  			a.Shutdown()
  			return
  
  		case <-a.shutdownCh:
  			return
  		}
  	}
  }
docs: // eventLoop listens to events from Serf and fans out to event handlers