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
bd5c6706
Commit
bd5c6706
authored
Sep 07, 2014
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up merge of bren2010's crypto branch and merge into master
parent
0b02834c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
dht.go
dht.go
+4
-1
dht_test.go
dht_test.go
+2
-2
ext_test.go
ext_test.go
+0
-2
No files found.
dht.go
View file @
bd5c6706
...
...
@@ -648,7 +648,10 @@ func (dht *IpfsDHT) peerFromInfo(pbp *PBDHTMessage_PBPeer) (*peer.Peer, error) {
}
func
(
dht
*
IpfsDHT
)
loadProvidableKeys
()
error
{
kl
:=
dht
.
datastore
.
KeyList
()
kl
,
err
:=
dht
.
datastore
.
KeyList
()
if
err
!=
nil
{
return
err
}
for
_
,
k
:=
range
kl
{
dht
.
providers
.
AddProvider
(
u
.
Key
(
k
.
Bytes
()),
dht
.
self
)
}
...
...
dht_test.go
View file @
bd5c6706
...
...
@@ -29,7 +29,7 @@ func setupDHTS(n int, t *testing.T) ([]*ma.Multiaddr, []*peer.Peer, []*IpfsDHT)
for
i
:=
0
;
i
<
4
;
i
++
{
p
:=
new
(
peer
.
Peer
)
p
.
AddAddress
(
addrs
[
i
])
sk
,
pk
,
err
:=
ci
.
GenerateKeyPair
(
ci
.
RSA
,
256
)
sk
,
pk
,
err
:=
ci
.
GenerateKeyPair
(
ci
.
RSA
,
512
)
if
err
!=
nil
{
panic
(
err
)
}
...
...
@@ -61,7 +61,7 @@ func setupDHTS(n int, t *testing.T) ([]*ma.Multiaddr, []*peer.Peer, []*IpfsDHT)
func
makePeer
(
addr
*
ma
.
Multiaddr
)
*
peer
.
Peer
{
p
:=
new
(
peer
.
Peer
)
p
.
AddAddress
(
addr
)
sk
,
pk
,
err
:=
ci
.
GenerateKeyPair
(
ci
.
RSA
,
256
)
sk
,
pk
,
err
:=
ci
.
GenerateKeyPair
(
ci
.
RSA
,
512
)
if
err
!=
nil
{
panic
(
err
)
}
...
...
ext_test.go
View file @
bd5c6706
...
...
@@ -189,7 +189,6 @@ func TestNotFound(t *testing.T) {
// Reply with random peers to every message
fn
.
AddHandler
(
func
(
mes
*
swarm
.
Message
)
*
swarm
.
Message
{
t
.
Log
(
"Handling message..."
)
pmes
:=
new
(
PBDHTMessage
)
err
:=
proto
.
Unmarshal
(
mes
.
Data
,
pmes
)
if
err
!=
nil
{
...
...
@@ -252,7 +251,6 @@ func TestLessThanKResponses(t *testing.T) {
// Reply with random peers to every message
fn
.
AddHandler
(
func
(
mes
*
swarm
.
Message
)
*
swarm
.
Message
{
t
.
Log
(
"Handling message..."
)
pmes
:=
new
(
PBDHTMessage
)
err
:=
proto
.
Unmarshal
(
mes
.
Data
,
pmes
)
if
err
!=
nil
{
...
...
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