Commit d7a5d2ec authored by Juan Batiz-Benet's avatar Juan Batiz-Benet
Browse files

p2p: own addresses gotten from host

parent 8a2f08f3
...@@ -67,11 +67,6 @@ func (mn *mocknet) AddPeer(k ic.PrivKey, a ma.Multiaddr) (host.Host, error) { ...@@ -67,11 +67,6 @@ func (mn *mocknet) AddPeer(k ic.PrivKey, a ma.Multiaddr) (host.Host, error) {
} }
h := bhost.New(n) h := bhost.New(n)
// make sure to add listening address!
// this makes debugging things simpler as remembering to register
// an address may cause unexpected failure.
n.Peerstore().AddAddress(n.LocalPeer(), a)
log.Debugf("mocknet added listen addr for peer: %s -- %s", n.LocalPeer(), a) log.Debugf("mocknet added listen addr for peer: %s -- %s", n.LocalPeer(), a)
mn.cg.AddChildGroup(n.cg) mn.cg.AddChildGroup(n.cg)
......
...@@ -141,17 +141,13 @@ func (ids *IDService) populateMessage(mes *pb.Identify, c inet.Conn) { ...@@ -141,17 +141,13 @@ func (ids *IDService) populateMessage(mes *pb.Identify, c inet.Conn) {
// "public" address, at least in relation to us. // "public" address, at least in relation to us.
mes.ObservedAddr = c.RemoteMultiaddr().Bytes() mes.ObservedAddr = c.RemoteMultiaddr().Bytes()
// set listen addrs // set listen addrs, get our latest addrs from Host.
laddrs, err := ids.Host.Network().InterfaceListenAddresses() laddrs := ids.Host.Addrs()
if err != nil { mes.ListenAddrs = make([][]byte, len(laddrs))
log.Error(err) for i, addr := range laddrs {
} else { mes.ListenAddrs[i] = addr.Bytes()
mes.ListenAddrs = make([][]byte, len(laddrs))
for i, addr := range laddrs {
mes.ListenAddrs[i] = addr.Bytes()
}
log.Debugf("%s sent listen addrs to %s: %s", c.LocalPeer(), c.RemotePeer(), laddrs)
} }
log.Debugf("%s sent listen addrs to %s: %s", c.LocalPeer(), c.RemotePeer(), laddrs)
// set protocol versions // set protocol versions
s := IpfsVersion.String() s := IpfsVersion.String()
......
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