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
f138a875
Commit
f138a875
authored
Oct 17, 2014
by
Jeromy
Committed by
Juan Batiz-Benet
Oct 18, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small changes to auxiliary dht functions
parent
9dbba5c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
dht.go
dht.go
+9
-2
No files found.
dht.go
View file @
f138a875
...
...
@@ -23,6 +23,8 @@ import (
var
log
=
u
.
Logger
(
"dht"
)
const
doPinging
=
true
// TODO. SEE https://github.com/jbenet/node-ipfs/blob/master/submodules/ipfs-dht/index.js
// IpfsDHT is an implementation of Kademlia with Coral and S/Kademlia modifications.
...
...
@@ -75,7 +77,9 @@ func NewDHT(ctx context.Context, p *peer.Peer, ps peer.Peerstore, net inet.Netwo
dht
.
routingTables
[
2
]
=
kb
.
NewRoutingTable
(
20
,
kb
.
ConvertPeerID
(
p
.
ID
),
time
.
Hour
)
dht
.
birth
=
time
.
Now
()
go
dht
.
PingRoutine
(
time
.
Second
*
10
)
if
doPinging
{
go
dht
.
PingRoutine
(
time
.
Second
*
10
)
}
return
dht
}
...
...
@@ -562,5 +566,8 @@ func (dht *IpfsDHT) PingRoutine(t time.Duration) {
func
(
dht
*
IpfsDHT
)
Bootstrap
(
ctx
context
.
Context
)
{
id
:=
make
([]
byte
,
16
)
rand
.
Read
(
id
)
dht
.
FindPeer
(
ctx
,
peer
.
ID
(
id
))
_
,
err
:=
dht
.
FindPeer
(
ctx
,
peer
.
ID
(
id
))
if
err
!=
nil
{
log
.
Error
(
"Bootstrap peer error: %s"
,
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