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-swarm
Commits
3563ed1f
Unverified
Commit
3563ed1f
authored
Feb 19, 2021
by
Aarsh Shah
Committed by
GitHub
Feb 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix swarm transient conn (#241)
parent
f82c4250
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
swarm.go
swarm.go
+0
-6
swarm_conn.go
swarm_conn.go
+6
-0
No files found.
swarm.go
View file @
3563ed1f
...
...
@@ -360,12 +360,6 @@ func (s *Swarm) NewStream(ctx context.Context, p peer.ID) (network.Stream, error
}
}
if
c
.
Stat
()
.
Transient
{
if
useTransient
,
_
:=
network
.
GetUseTransient
(
ctx
);
!
useTransient
{
return
nil
,
network
.
ErrTransientConn
}
}
s
,
err
:=
c
.
NewStream
(
ctx
)
if
err
!=
nil
{
if
c
.
conn
.
IsClosed
()
{
...
...
swarm_conn.go
View file @
3563ed1f
...
...
@@ -177,6 +177,12 @@ func (c *Conn) Stat() network.Stat {
// NewStream returns a new Stream from this connection
func
(
c
*
Conn
)
NewStream
(
ctx
context
.
Context
)
(
network
.
Stream
,
error
)
{
if
c
.
Stat
()
.
Transient
{
if
useTransient
,
_
:=
network
.
GetUseTransient
(
ctx
);
!
useTransient
{
return
nil
,
network
.
ErrTransientConn
}
}
ts
,
err
:=
c
.
conn
.
OpenStream
(
ctx
)
if
err
!=
nil
{
...
...
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