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-dms3
Commits
d749930d
Commit
d749930d
authored
Apr 02, 2015
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dht-handlers-log-keys
parent
49758056
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
routing/dht/handlers.go
routing/dht/handlers.go
+11
-2
No files found.
routing/dht/handlers.go
View file @
d749930d
...
...
@@ -10,6 +10,7 @@ import (
peer
"github.com/ipfs/go-ipfs/p2p/peer"
pb
"github.com/ipfs/go-ipfs/routing/dht/pb"
u
"github.com/ipfs/go-ipfs/util"
lgbl
"github.com/ipfs/go-ipfs/util/eventlog/loggables"
)
// The number of closer peers to send on requests.
...
...
@@ -157,9 +158,13 @@ func (dht *IpfsDHT) handleFindPeer(ctx context.Context, p peer.ID, pmes *pb.Mess
}
func
(
dht
*
IpfsDHT
)
handleGetProviders
(
ctx
context
.
Context
,
p
peer
.
ID
,
pmes
*
pb
.
Message
)
(
*
pb
.
Message
,
error
)
{
defer
log
.
EventBegin
(
ctx
,
"handleGetProviders"
,
p
)
.
Done
()
lm
:=
make
(
lgbl
.
DeferredMap
)
lm
[
"peer"
]
=
func
()
interface
{}
{
return
p
.
Pretty
()
}
defer
log
.
EventBegin
(
ctx
,
"handleGetProviders"
,
lm
)
.
Done
()
resp
:=
pb
.
NewMessage
(
pmes
.
GetType
(),
pmes
.
GetKey
(),
pmes
.
GetClusterLevel
())
key
:=
u
.
Key
(
pmes
.
GetKey
())
lm
[
"key"
]
=
func
()
interface
{}
{
return
key
.
Pretty
()
}
// debug logging niceness.
reqDesc
:=
fmt
.
Sprintf
(
"%s handleGetProviders(%s, %s): "
,
dht
.
self
,
p
,
key
)
...
...
@@ -198,8 +203,12 @@ func (dht *IpfsDHT) handleGetProviders(ctx context.Context, p peer.ID, pmes *pb.
}
func
(
dht
*
IpfsDHT
)
handleAddProvider
(
ctx
context
.
Context
,
p
peer
.
ID
,
pmes
*
pb
.
Message
)
(
*
pb
.
Message
,
error
)
{
defer
log
.
EventBegin
(
ctx
,
"handleAddProvider"
,
p
)
.
Done
()
lm
:=
make
(
lgbl
.
DeferredMap
)
lm
[
"peer"
]
=
func
()
interface
{}
{
return
p
.
Pretty
()
}
defer
log
.
EventBegin
(
ctx
,
"handleAddProvider"
,
lm
)
.
Done
()
key
:=
u
.
Key
(
pmes
.
GetKey
())
lm
[
"key"
]
=
func
()
interface
{}
{
return
key
.
Pretty
()
}
log
.
Debugf
(
"%s adding %s as a provider for '%s'
\n
"
,
dht
.
self
,
p
,
key
)
...
...
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