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-tcp-transport
Commits
6ebba718
Commit
6ebba718
authored
Mar 21, 2017
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up reusedial and remove go-libp2p-logging
parent
823812a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
19 deletions
+6
-19
package.json
package.json
+0
-6
tcp.go
tcp.go
+6
-13
No files found.
package.json
View file @
6ebba718
...
...
@@ -7,12 +7,6 @@
"dvcsimport"
:
"github.com/libp2p/go-tcp-transport"
},
"gxDependencies"
:
[
{
"author"
:
"whyrusleeping"
,
"hash"
:
"QmXs1igHHEaUmMxKtbP8Z9wTjitQ75sqxaKQP4QgnLN4nn"
,
"name"
:
"go-libp2p-loggables"
,
"version"
:
"1.1.1"
},
{
"author"
:
"whyrusleeping"
,
"hash"
:
"QmeJcz1smiskcJbPRTWpzqnLpD2vYqkNiGHVrckaaWHCLv"
,
...
...
tcp.go
View file @
6ebba718
...
...
@@ -9,7 +9,6 @@ import (
logging
"github.com/ipfs/go-log"
reuseport
"github.com/jbenet/go-reuseport"
lgbl
"github.com/libp2p/go-libp2p-loggables"
tpt
"github.com/libp2p/go-libp2p-transport"
ma
"github.com/multiformats/go-multiaddr"
manet
"github.com/multiformats/go-multiaddr-net"
...
...
@@ -202,33 +201,27 @@ func (d *tcpDialer) DialContext(ctx context.Context, raddr ma.Multiaddr) (tpt.Co
}
func
(
d
*
tcpDialer
)
reuseDial
(
ctx
context
.
Context
,
raddr
ma
.
Multiaddr
)
(
manet
.
Conn
,
error
)
{
logdial
:=
lgbl
.
Dial
(
"conn"
,
""
,
""
,
d
.
laddr
,
raddr
)
rpev
:=
log
.
EventBegin
(
ctx
,
"tptDialReusePort"
,
logdial
)
network
,
netraddr
,
err
:=
manet
.
DialArgs
(
raddr
)
if
err
!=
nil
{
return
nil
,
err
}
_
=
ctx
// TODO: implement DialContext in reuseport
rpev
:=
log
.
EventBegin
(
ctx
,
"tptDialReusePort"
,
logging
.
LoggableMap
{
"raddr"
:
raddr
,
})
con
,
err
:=
d
.
rd
.
DialContext
(
ctx
,
network
,
netraddr
)
if
err
==
nil
{
logdial
[
"reuseport"
]
=
"success"
rpev
.
Done
()
return
manet
.
WrapNetConn
(
con
)
}
rpev
.
SetError
(
err
)
rpev
.
Done
()
if
!
ReuseErrShouldRetry
(
err
)
{
logdial
[
"reuseport"
]
=
"failure"
logdial
[
"error"
]
=
err
rpev
.
Done
()
return
nil
,
err
}
logdial
[
"reuseport"
]
=
"retry"
logdial
[
"error"
]
=
err
rpev
.
Done
()
return
d
.
madialer
.
DialContext
(
ctx
,
raddr
)
}
...
...
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