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
7c9431ba
Commit
7c9431ba
authored
Jan 15, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add events for handlers
parent
3c559028
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
routing/dht/handlers.go
routing/dht/handlers.go
+5
-0
No files found.
routing/dht/handlers.go
View file @
7c9431ba
...
...
@@ -39,6 +39,7 @@ func (dht *IpfsDHT) handlerForMsgType(t pb.Message_MessageType) dhtHandler {
}
func
(
dht
*
IpfsDHT
)
handleGetValue
(
ctx
context
.
Context
,
p
peer
.
ID
,
pmes
*
pb
.
Message
)
(
*
pb
.
Message
,
error
)
{
defer
log
.
EventBegin
(
ctx
,
"handleGetValue"
,
p
)
.
Done
()
log
.
Debugf
(
"%s handleGetValue for key: %s"
,
dht
.
self
,
pmes
.
GetKey
())
// setup response
...
...
@@ -114,6 +115,7 @@ func (dht *IpfsDHT) handleGetValue(ctx context.Context, p peer.ID, pmes *pb.Mess
// Store a value in this peer local storage
func
(
dht
*
IpfsDHT
)
handlePutValue
(
ctx
context
.
Context
,
p
peer
.
ID
,
pmes
*
pb
.
Message
)
(
*
pb
.
Message
,
error
)
{
defer
log
.
EventBegin
(
ctx
,
"handlePutValue"
,
p
)
.
Done
()
dskey
:=
u
.
Key
(
pmes
.
GetKey
())
.
DsKey
()
if
err
:=
dht
.
verifyRecordLocally
(
pmes
.
GetRecord
());
err
!=
nil
{
...
...
@@ -137,6 +139,7 @@ func (dht *IpfsDHT) handlePing(_ context.Context, p peer.ID, pmes *pb.Message) (
}
func
(
dht
*
IpfsDHT
)
handleFindPeer
(
ctx
context
.
Context
,
p
peer
.
ID
,
pmes
*
pb
.
Message
)
(
*
pb
.
Message
,
error
)
{
defer
log
.
EventBegin
(
ctx
,
"handleFindPeer"
,
p
)
.
Done
()
resp
:=
pb
.
NewMessage
(
pmes
.
GetType
(),
""
,
pmes
.
GetClusterLevel
())
var
closest
[]
peer
.
ID
...
...
@@ -166,6 +169,7 @@ 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
()
resp
:=
pb
.
NewMessage
(
pmes
.
GetType
(),
pmes
.
GetKey
(),
pmes
.
GetClusterLevel
())
key
:=
u
.
Key
(
pmes
.
GetKey
())
...
...
@@ -211,6 +215,7 @@ type providerInfo struct {
}
func
(
dht
*
IpfsDHT
)
handleAddProvider
(
ctx
context
.
Context
,
p
peer
.
ID
,
pmes
*
pb
.
Message
)
(
*
pb
.
Message
,
error
)
{
defer
log
.
EventBegin
(
ctx
,
"handleAddProvider"
,
p
)
.
Done
()
key
:=
u
.
Key
(
pmes
.
GetKey
())
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