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
dms3
go-dms3
Commits
633b04e5
Commit
633b04e5
authored
May 11, 2018
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
p2p: remove redundant listener address check
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
a0ad8cfd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
21 deletions
+10
-21
p2p/outbound.go
p2p/outbound.go
+10
-21
No files found.
p2p/outbound.go
View file @
633b04e5
...
...
@@ -2,7 +2,6 @@ package p2p
import
(
"context"
"errors"
"time"
ma
"gx/ipfs/QmWWQ2Txc2c6tqjsBpzg5Ar652cHPGNsQQp2SejkNmkUMb/go-multiaddr"
...
...
@@ -29,34 +28,24 @@ type outboundListener struct {
// Dial creates new P2P stream to a remote listener
func
(
p2p
*
P2P
)
Dial
(
ctx
context
.
Context
,
peer
peer
.
ID
,
proto
string
,
bindAddr
ma
.
Multiaddr
)
(
Listener
,
error
)
{
lnet
,
_
,
err
:=
manet
.
DialArgs
(
bindAddr
)
maListener
,
err
:=
manet
.
Listen
(
bindAddr
)
if
err
!=
nil
{
return
nil
,
err
}
switch
lnet
{
case
"tcp"
,
"tcp4"
,
"tcp6"
:
maListener
,
err
:=
manet
.
Listen
(
bindAddr
)
if
err
!=
nil
{
return
nil
,
err
}
listener
:=
&
outboundListener
{
p2p
:
p2p
,
id
:
p2p
.
identity
,
listener
:=
&
outboundListener
{
p2p
:
p2p
,
id
:
p2p
.
identity
,
proto
:
proto
,
peer
:
peer
,
proto
:
proto
,
peer
:
peer
,
listener
:
maListener
,
}
listener
:
maListener
,
}
go
listener
.
acceptConns
()
go
listener
.
acceptConns
()
return
listener
,
nil
default
:
return
nil
,
errors
.
New
(
"unsupported proto: "
+
lnet
)
}
return
listener
,
nil
}
func
(
l
*
outboundListener
)
dial
()
(
net
.
Stream
,
error
)
{
...
...
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