Skip to content

Commit

Permalink
Merge pull request #23 from libp2p/context-discover-gateway
Browse files Browse the repository at this point in the history
pass a context to DiscoverGateway
  • Loading branch information
marten-seemann committed Sep 19, 2021
2 parents 558869f + d0d64ea commit 73b4c1e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions nat.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ func DiscoverNATs(ctx context.Context) <-chan NAT {
}

// DiscoverGateway attempts to find a gateway device.
func DiscoverGateway() (NAT, error) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

func DiscoverGateway(ctx context.Context) (NAT, error) {
var nats []NAT
for nat := range DiscoverNATs(ctx) {
nats = append(nats, nat)
Expand Down

0 comments on commit 73b4c1e

Please sign in to comment.