Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
067e66b3
Commit
067e66b3
authored
Jun 04, 2015
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1185 from fjl/p2p-nat-timeouts
p2p/nat: request timeouts for UPnP discovery
parents
8b4605c3
fc6a5ae3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
4 deletions
+10
-4
Godeps.json
Godeps/Godeps.json
+1
-1
goupnp.go
Godeps/_workspace/src/github.com/huin/goupnp/goupnp.go
+6
-3
natupnp.go
p2p/nat/natupnp.go
+3
-0
No files found.
Godeps/Godeps.json
View file @
067e66b3
...
...
@@ -31,7 +31,7 @@
},
{
"ImportPath"
:
"github.com/huin/goupnp"
,
"Rev"
:
"
c57ae84388ab59076fd547f1abeab71c2edb0a21
"
"Rev"
:
"
5cff77a69fb22f5f1774c4451ea2aab63d4d2f20
"
},
{
"ImportPath"
:
"github.com/jackpal/go-nat-pmp"
,
...
...
Godeps/_workspace/src/github.com/huin/goupnp/goupnp.go
View file @
067e66b3
...
...
@@ -19,7 +19,7 @@ import (
"fmt"
"net/http"
"net/url"
"time"
"golang.org/x/net/html/charset"
"github.com/huin/goupnp/httpu"
...
...
@@ -64,7 +64,6 @@ func DiscoverDevices(searchTarget string) ([]MaybeRootDevice, error) {
maybe
:=
&
results
[
i
]
loc
,
err
:=
response
.
Location
()
if
err
!=
nil
{
maybe
.
Err
=
ContextError
{
"unexpected bad location from search"
,
err
}
continue
}
...
...
@@ -93,7 +92,11 @@ func DiscoverDevices(searchTarget string) ([]MaybeRootDevice, error) {
}
func
requestXml
(
url
string
,
defaultSpace
string
,
doc
interface
{})
error
{
resp
,
err
:=
http
.
Get
(
url
)
timeout
:=
time
.
Duration
(
3
*
time
.
Second
)
client
:=
http
.
Client
{
Timeout
:
timeout
,
}
resp
,
err
:=
client
.
Get
(
url
)
if
err
!=
nil
{
return
err
}
...
...
p2p/nat/natupnp.go
View file @
067e66b3
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment