mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-09 15:46:43 +00:00
20 lines
496 B
Go
20 lines
496 B
Go
package rpc
|
|
|
|
import (
|
|
"github.com/kaspanet/kaspad/util/random"
|
|
"github.com/kaspanet/kaspad/wire"
|
|
)
|
|
|
|
// handlePing implements the ping command.
|
|
func handlePing(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
|
|
// Ask server to ping \o_
|
|
nonce, err := random.Uint64()
|
|
if err != nil {
|
|
return nil, internalRPCError("Not sending ping - failed to "+
|
|
"generate nonce: "+err.Error(), "")
|
|
}
|
|
s.cfg.ConnMgr.BroadcastMessage(wire.NewMsgPing(nonce))
|
|
|
|
return nil, nil
|
|
}
|