Skip to content

Commit

Permalink
add more logging and be defensive of invalid or incorrect events comi…
Browse files Browse the repository at this point in the history
…ng through a subscription
  • Loading branch information
aschmahmann committed Mar 6, 2020
1 parent f3cb345 commit a65ba4e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion subscriber_notifee.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,15 @@ func (nn *subscriberNotifee) subscribe(proc goprocess.Process) {
case event.EvtPeerProtocolsUpdated:
handlePeerProtocolsUpdatedEvent(dht, evt)
case event.EvtLocalReachabilityChanged:
handleLocalReachabilityChangedEvent(dht, evt)
if dht.auto {
handleLocalReachabilityChangedEvent(dht, evt)
} else {
// something has gone really wrong if we get an event we did not subscribe to
logger.Errorf("received LocalReachabilityChanged event that was not subscribed to")
}
default:
// something has gone really wrong if we get an event for another type
logger.Errorf("got wrong type from subscription: %T", e)
}
case <-proc.Closing():
return
Expand Down

0 comments on commit a65ba4e

Please sign in to comment.