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
e71f7af3
Commit
e71f7af3
authored
Nov 04, 2019
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(swarm): return unwrapped context deadline errors
parent
f4bb4313
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
swarm_dial.go
swarm_dial.go
+5
-4
No files found.
swarm_dial.go
View file @
e71f7af3
...
...
@@ -317,13 +317,14 @@ func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) {
connC
,
dialErr
:=
s
.
dialAddrs
(
ctx
,
p
,
goodAddrsChan
)
if
dialErr
!=
nil
{
logdial
[
"error"
]
=
dialErr
.
Cause
.
Error
()
if
dialErr
.
Cause
==
context
.
Canceled
{
// always prefer the "context canceled" error.
// we rely on behing able to check `err == context.Canceled`
switch
dialErr
.
Cause
{
case
context
.
Canceled
,
context
.
DeadlineExceeded
:
// Always prefer the context errors as we rely on being
// able to check them.
//
// Removing this will BREAK backoff (causing us to
// backoff when canceling dials).
return
nil
,
context
.
Canceled
return
nil
,
dialErr
.
Cause
}
return
nil
,
dialErr
}
...
...
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