Commit eae26b65 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

added WrapNetListener

parent 04044c22
...@@ -236,13 +236,17 @@ func Listen(laddr ma.Multiaddr) (Listener, error) { ...@@ -236,13 +236,17 @@ func Listen(laddr ma.Multiaddr) (Listener, error) {
return nil, err return nil, err
} }
// we need to fetch the new multiaddr from the listener, as it // we want to fetch the new multiaddr from the listener, as it may
// may have resolved to some other value. // have resolved to some other value. WrapNetListener does it for us.
nladdr, err := FromNetAddr(nl.Addr()) 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 { if err != nil {
return nil, err return nil, err
} }
laddr = nladdr
return &maListener{ return &maListener{
Listener: nl, Listener: nl,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment