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-pubsub
Commits
ae0fcc6b
Commit
ae0fcc6b
authored
Nov 11, 2019
by
vyzo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add traces for send/drop rpc
forgotten!
parent
151ec256
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
4 deletions
+30
-4
trace.go
trace.go
+30
-4
No files found.
trace.go
View file @
ae0fcc6b
...
...
@@ -152,15 +152,41 @@ func (t *pubsubTracer) RecvRPC(rpc *RPC) {
}
func
(
t
*
pubsubTracer
)
SendRPC
(
rpc
*
RPC
,
p
peer
.
ID
)
{
if
t
!
=
nil
{
// TODO
if
t
=
=
nil
{
return
}
now
:=
time
.
Now
()
.
UnixNano
()
evt
:=
&
pb
.
TraceEvent
{
Type
:
pb
.
TraceEvent_SEND_RPC
.
Enum
(),
PeerID
:
[]
byte
(
t
.
pid
),
Timestamp
:
&
now
,
SendRPC
:
&
pb
.
TraceEvent_SendRPC
{
SendTo
:
[]
byte
(
rpc
.
from
),
Meta
:
traceRPCMeta
(
rpc
),
},
}
t
.
tracer
.
Trace
(
evt
)
}
func
(
t
*
pubsubTracer
)
DropRPC
(
rpc
*
RPC
,
p
peer
.
ID
)
{
if
t
!
=
nil
{
// TODO
if
t
=
=
nil
{
return
}
now
:=
time
.
Now
()
.
UnixNano
()
evt
:=
&
pb
.
TraceEvent
{
Type
:
pb
.
TraceEvent_DROP_RPC
.
Enum
(),
PeerID
:
[]
byte
(
t
.
pid
),
Timestamp
:
&
now
,
DropRPC
:
&
pb
.
TraceEvent_DropRPC
{
SendTo
:
[]
byte
(
rpc
.
from
),
Meta
:
traceRPCMeta
(
rpc
),
},
}
t
.
tracer
.
Trace
(
evt
)
}
func
traceRPCMeta
(
rpc
*
RPC
)
*
pb
.
TraceEvent_RPCMeta
{
...
...
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