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
c827b8ba
Unverified
Commit
c827b8ba
authored
Apr 09, 2019
by
Steven Allen
Committed by
GitHub
Apr 09, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #21 from libp2p/fix/full-close
fully close the autonat client stream
parents
af9b2abb
86c0a65d
Pipeline
#465
failed with stages
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
client.go
client.go
+5
-1
No files found.
client.go
View file @
c827b8ba
...
...
@@ -49,7 +49,9 @@ func (c *client) DialBack(ctx context.Context, p peer.ID) (ma.Multiaddr, error)
if
err
!=
nil
{
return
nil
,
err
}
defer
s
.
Close
()
// Might as well just reset the stream. Once we get to this point, we
// don't care about being nice.
defer
inet
.
FullClose
(
s
)
r
:=
ggio
.
NewDelimitedReader
(
s
,
inet
.
MessageSizeMax
)
w
:=
ggio
.
NewDelimitedWriter
(
s
)
...
...
@@ -57,12 +59,14 @@ func (c *client) DialBack(ctx context.Context, p peer.ID) (ma.Multiaddr, error)
req
:=
newDialMessage
(
pstore
.
PeerInfo
{
ID
:
c
.
h
.
ID
(),
Addrs
:
c
.
getAddrs
()})
err
=
w
.
WriteMsg
(
req
)
if
err
!=
nil
{
s
.
Reset
()
return
nil
,
err
}
var
res
pb
.
Message
err
=
r
.
ReadMsg
(
&
res
)
if
err
!=
nil
{
s
.
Reset
()
return
nil
,
err
}
...
...
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