Skip to content

Commit

Permalink
defer subscription closes
Browse files Browse the repository at this point in the history
  • Loading branch information
willscott committed Feb 27, 2020
1 parent f5386bd commit ae33956
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions p2p/host/relay/autorelay.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,13 @@ func (ar *AutoRelay) hostAddrs(addrs []ma.Multiaddr) []ma.Multiaddr {
func (ar *AutoRelay) background(ctx context.Context) {
subNatPublic, _ := ar.host.EventBus().Subscribe(new(event.EvtLocalRoutabilityPublic))
pubChan := subNatPublic.Out()
defer subNatPublic.Close()
subNatPrivate, _ := ar.host.EventBus().Subscribe(new(event.EvtLocalRoutabilityPrivate))
priChan := subNatPrivate.Out()
defer subNatPrivate.Close()
subNatUnknown, _ := ar.host.EventBus().Subscribe(new(event.EvtLocalRoutabilityUnknown))
unkChan := subNatUnknown.Out()
defer subNatUnknown.Close()

// when true, we need to identify push
push := false
Expand Down

0 comments on commit ae33956

Please sign in to comment.