MCPcopy Create free account
hub / github.com/DNAProject/DNA / pingTo

Method pingTo

p2pserver/p2pserver.go:517–525  ·  view source on GitHub ↗

pings send pkgs to get pong msg from others

(peers []*peer.Peer)

Source from the content-addressed store, hash-verified

515
516//pings send pkgs to get pong msg from others
517func (this *P2PServer) pingTo(peers []*peer.Peer) {
518 for _, p := range peers {
519 if p.GetState() == common.ESTABLISH {
520 height := this.ledger.GetCurrentBlockHeight()
521 ping := msgpack.NewPingMsg(uint64(height))
522 go this.Send(p, ping, false)
523 }
524 }
525}
526
527//timeout trace whether some peer be long time no response
528func (this *P2PServer) timeout() {

Callers 2

pingMethod · 0.95
pingOutsyncNodesMethod · 0.80

Calls 3

SendMethod · 0.95
GetCurrentBlockHeightMethod · 0.65
GetStateMethod · 0.45

Tested by

no test coverage detected