aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/nat
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-06-05 06:55:39 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-06-05 06:55:39 +0800
commit067e66b34869402cf7bd0f352dad37bd4200e976 (patch)
tree6576ad0110b364685dfd3ef71b3e8019226c35e8 /p2p/nat
parent8b4605c336568065ea1d2fa1298c3a8489f9bf9e (diff)
parentfc6a5ae3ec7990d5c78649b0af46c46f31b88040 (diff)
downloadgo-tangerine-067e66b34869402cf7bd0f352dad37bd4200e976.tar
go-tangerine-067e66b34869402cf7bd0f352dad37bd4200e976.tar.gz
go-tangerine-067e66b34869402cf7bd0f352dad37bd4200e976.tar.bz2
go-tangerine-067e66b34869402cf7bd0f352dad37bd4200e976.tar.lz
go-tangerine-067e66b34869402cf7bd0f352dad37bd4200e976.tar.xz
go-tangerine-067e66b34869402cf7bd0f352dad37bd4200e976.tar.zst
go-tangerine-067e66b34869402cf7bd0f352dad37bd4200e976.zip
Merge pull request #1185 from fjl/p2p-nat-timeouts
p2p/nat: request timeouts for UPnP discovery
Diffstat (limited to 'p2p/nat')
-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