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
mf
go-multiaddr
Commits
eae26b65
Commit
eae26b65
authored
Jan 18, 2015
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added WrapNetListener
parent
04044c22
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
net.go
net.go
+8
-4
No files found.
net.go
View file @
eae26b65
...
...
@@ -236,13 +236,17 @@ func Listen(laddr ma.Multiaddr) (Listener, error) {
return
nil
,
err
}
// we need to fetch the new multiaddr from the listener, as it
// may have resolved to some other value.
nladdr
,
err
:=
FromNetAddr
(
nl
.
Addr
())
// we want to fetch the new multiaddr from the listener, as it may
// have resolved to some other value. WrapNetListener does it for us.
return
WrapNetListener
(
nl
)
}
// WrapNetListener wraps a net.Listener with a manet.Listener.
func
WrapNetListener
(
nl
net
.
Listener
)
(
Listener
,
error
)
{
laddr
,
err
:=
FromNetAddr
(
nl
.
Addr
())
if
err
!=
nil
{
return
nil
,
err
}
laddr
=
nladdr
return
&
maListener
{
Listener
:
nl
,
...
...
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