aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-06-04 20:05:52 +0800
committerFelix Lange <fjl@twurst.com>2015-06-05 04:25:43 +0800
commitfc6a5ae3ec7990d5c78649b0af46c46f31b88040 (patch)
tree6576ad0110b364685dfd3ef71b3e8019226c35e8 /p2p
parent6a831ca015c746472589e9039b41d0fd6d4a9af0 (diff)
downloaddexon-fc6a5ae3ec7990d5c78649b0af46c46f31b88040.tar
dexon-fc6a5ae3ec7990d5c78649b0af46c46f31b88040.tar.gz
dexon-fc6a5ae3ec7990d5c78649b0af46c46f31b88040.tar.bz2
dexon-fc6a5ae3ec7990d5c78649b0af46c46f31b88040.tar.lz
dexon-fc6a5ae3ec7990d5c78649b0af46c46f31b88040.tar.xz
dexon-fc6a5ae3ec7990d5c78649b0af46c46f31b88040.tar.zst
dexon-fc6a5ae3ec7990d5c78649b0af46c46f31b88040.zip
p2p/nat: add timeout for UPnP SOAP requests
Diffstat (limited to 'p2p')
-rw-r--r--p2p/nat/natupnp.go3
1 files changed, 3 insertions, 0 deletions
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