Unverified Commit 7274874c authored by Aarsh Shah's avatar Aarsh Shah Committed by GitHub

Merge pull request #135 from multiformats/feat/fix-local-addr

Fix Local Address on TCP connections
parents d18c05e0 900a4d7e
...@@ -255,7 +255,15 @@ func (l *maListener) Accept() (Conn, error) { ...@@ -255,7 +255,15 @@ func (l *maListener) Accept() (Conn, error) {
} }
} }
return wrap(nconn, l.laddr, raddr), nil var laddr ma.Multiaddr
if nconn.LocalAddr().String() != "" {
laddr, err = FromNetAddr(nconn.LocalAddr())
if err != nil {
return nil, fmt.Errorf("failed to convert conn.LocalAddr: %s", err)
}
}
return wrap(nconn, laddr, raddr), nil
} }
// Multiaddr returns the listener's (local) Multiaddr. // Multiaddr returns the listener's (local) Multiaddr.
......
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