Listen Error

This commit is contained in:
Sarah Jamie Lewis 2019-07-24 12:26:44 -07:00
parent 101cce532f
commit 815ec2565b
1 changed files with 4 additions and 2 deletions

View File

@ -145,15 +145,17 @@ func (e *engine) createPeerTemplate() *PeerApp {
// Listen sets up an onion listener to process incoming cwtch messages
func (e *engine) listenFn() {
err := e.service.Listen(e.createPeerTemplate())
e.eventManager.Publish(event.NewEvent(event.ProtocolEngineStopped, map[event.Field]string{event.Identity: e.identity.Hostname(), event.Error: err.Error()}))
if !e.shuttingDown {
e.eventManager.Publish(event.NewEvent(event.ProtocolEngineStopped, map[event.Field]string{event.Identity: e.identity.Hostname(), event.Error: err.Error()}))
}
return
}
// Shutdown tears down the eventHandler goroutine
func (e *engine) Shutdown() {
e.shuttingDown = true
e.service.Shutdown()
e.connectionsManager.Shutdown()
e.service.Shutdown()
e.queue.Shutdown()
}