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-unixfs
Commits
158f5061
Commit
158f5061
authored
Jan 26, 2015
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
p2p: own addresses gotten from host
parent
fda92754
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
15 deletions
+6
-15
p2p/net/mock/mock_net.go
p2p/net/mock/mock_net.go
+0
-5
p2p/protocol/identify/id.go
p2p/protocol/identify/id.go
+6
-10
No files found.
p2p/net/mock/mock_net.go
View file @
158f5061
...
...
@@ -67,11 +67,6 @@ func (mn *mocknet) AddPeer(k ic.PrivKey, a ma.Multiaddr) (host.Host, error) {
}
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
)
mn
.
cg
.
AddChildGroup
(
n
.
cg
)
...
...
p2p/protocol/identify/id.go
View file @
158f5061
...
...
@@ -141,17 +141,13 @@ func (ids *IDService) populateMessage(mes *pb.Identify, c inet.Conn) {
// "public" address, at least in relation to us.
mes
.
ObservedAddr
=
c
.
RemoteMultiaddr
()
.
Bytes
()
// set listen addrs
laddrs
,
err
:=
ids
.
Host
.
Network
()
.
InterfaceListenAddresses
()
if
err
!=
nil
{
log
.
Error
(
err
)
}
else
{
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
)
// set listen addrs, get our latest addrs from Host.
laddrs
:=
ids
.
Host
.
Addrs
()
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
)
// set protocol versions
s
:=
IpfsVersion
.
String
()
...
...
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