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
p2p
go-p2p-kad-dht
Commits
bad7b6d4
Commit
bad7b6d4
authored
Sep 19, 2014
by
Juan Batiz-Benet
Committed by
Brian Tiger Chow
Sep 22, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dht.Connect(Peer)
parent
90075612
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
5 deletions
+2
-5
dht.go
dht.go
+2
-5
No files found.
dht.go
View file @
bad7b6d4
...
...
@@ -72,9 +72,8 @@ func NewDHT(p *peer.Peer, ps peer.Peerstore, net inet.Network, sender inet.Sende
}
// Connect to a new peer at the given address, ping and add to the routing table
func
(
dht
*
IpfsDHT
)
Connect
(
addr
*
ma
.
Multiaddr
)
(
*
peer
.
Peer
,
error
)
{
maddrstr
,
_
:=
addr
.
String
()
u
.
DOut
(
"Connect to new peer: %s
\n
"
,
maddrstr
)
func
(
dht
*
IpfsDHT
)
Connect
(
npeer
*
peer
.
Peer
)
(
*
peer
.
Peer
,
error
)
{
u
.
DOut
(
"Connect to new peer: %s
\n
"
,
npeer
.
ID
.
Pretty
())
// TODO(jbenet,whyrusleeping)
//
...
...
@@ -85,8 +84,6 @@ func (dht *IpfsDHT) Connect(addr *ma.Multiaddr) (*peer.Peer, error) {
//
// /ip4/10.20.30.40/tcp/1234/ipfs/Qxhxxchxzcncxnzcnxzcxzm
//
npeer
:=
&
peer
.
Peer
{}
npeer
.
AddAddress
(
addr
)
err
:=
dht
.
network
.
DialPeer
(
npeer
)
if
err
!=
nil
{
return
nil
,
err
...
...
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