aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/protocols/protocol.go
diff options
context:
space:
mode:
authorElad <theman@elad.im>2018-06-14 17:21:17 +0800
committerFelix Lange <fjl@users.noreply.github.com>2018-06-14 17:21:17 +0800
commit1836366ac19e30f157570e61342fae53bc6c8a57 (patch)
treea95b5027602d17315cd6462f7c08ac4123c9099d /p2p/protocols/protocol.go
parent591cef17d4f1700de50057fd6988b9731a2195c9 (diff)
downloaddexon-1836366ac19e30f157570e61342fae53bc6c8a57.tar.gz
dexon-1836366ac19e30f157570e61342fae53bc6c8a57.tar.zst
dexon-1836366ac19e30f157570e61342fae53bc6c8a57.zip
all: library changes for swarm-network-rewrite (#16898)
This commit adds all changes needed for the merge of swarm-network-rewrite. The changes: - build: increase linter timeout - contracts/ens: export ensNode - log: add Output method and enable fractional seconds in format - metrics: relax test timeout - p2p: reduced some log levels, updates to simulation packages - rpc: increased maxClientSubscriptionBuffer to 20000
Diffstat (limited to 'p2p/protocols/protocol.go')
-rw-r--r--p2p/protocols/protocol.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/p2p/protocols/protocol.go b/p2p/protocols/protocol.go
index 9914c9958..849a7ef39 100644
--- a/p2p/protocols/protocol.go
+++ b/p2p/protocols/protocol.go
@@ -33,7 +33,9 @@ import (
"fmt"
"reflect"
"sync"
+ "time"
+ "github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/p2p"
)
@@ -217,6 +219,8 @@ func (p *Peer) Drop(err error) {
// this low level call will be wrapped by libraries providing routed or broadcast sends
// but often just used to forward and push messages to directly connected peers
func (p *Peer) Send(msg interface{}) error {
+ defer metrics.GetOrRegisterResettingTimer("peer.send_t", nil).UpdateSince(time.Now())
+ metrics.GetOrRegisterCounter("peer.send", nil).Inc(1)
code, found := p.spec.GetCode(msg)
if !found {
return errorf(ErrInvalidMsgType, "%v", code)