Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-autonat
Commits
4b9ee569
Unverified
Commit
4b9ee569
authored
Feb 25, 2021
by
Steven Allen
Committed by
GitHub
Feb 25, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #99 from libp2p/fix/timeout-incoming-stream-reads
Fix: Stream read timeout
parents
a1074536
e4c7f4cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
svc.go
svc.go
+4
-0
No files found.
svc.go
View file @
4b9ee569
...
...
@@ -17,6 +17,8 @@ import (
ma
"github.com/multiformats/go-multiaddr"
)
var
streamReadTimeout
=
60
*
time
.
Second
// AutoNATService provides NAT autodetection services to other peers
type
autoNATService
struct
{
ctx
context
.
Context
...
...
@@ -48,6 +50,8 @@ func newAutoNATService(ctx context.Context, c *config) (*autoNATService, error)
}
func
(
as
*
autoNATService
)
handleStream
(
s
network
.
Stream
)
{
s
.
SetReadDeadline
(
time
.
Now
()
.
Add
(
streamReadTimeout
))
defer
s
.
Close
()
pid
:=
s
.
Conn
()
.
RemotePeer
()
...
...
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