From fc6a5ae3ec7990d5c78649b0af46c46f31b88040 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 4 Jun 2015 14:05:52 +0200 Subject: p2p/nat: add timeout for UPnP SOAP requests --- p2p/nat/natupnp.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'p2p') diff --git a/p2p/nat/natupnp.go b/p2p/nat/natupnp.go index ef7765e8d..21a9cf8b1 100644 --- a/p2p/nat/natupnp.go +++ b/p2p/nat/natupnp.go @@ -12,6 +12,8 @@ import ( "github.com/huin/goupnp/dcps/internetgateway2" ) +const soapRequestTimeout = 3 * time.Second + type upnp struct { dev *goupnp.RootDevice service string @@ -131,6 +133,7 @@ func discover(out chan<- *upnp, target string, matcher func(*goupnp.RootDevice, } // check for a matching IGD service sc := goupnp.ServiceClient{service.NewSOAPClient(), devs[i].Root, service} + sc.SOAPClient.HTTPClient.Timeout = soapRequestTimeout upnp := matcher(devs[i].Root, sc) if upnp == nil { return -- cgit v1.2.3