MCPcopy
hub / github.com/aceld/zinx / StartHeartBeat

Method StartHeartBeat

znet/server.go:544–557  ·  view source on GitHub ↗

StartHeartBeat starts the heartbeat check. interval is the time interval between each heartbeat. (启动心跳检测 interval 每次发送心跳的时间间隔)

(interval time.Duration)

Source from the content-addressed store, hash-verified

542// (启动心跳检测
543// interval 每次发送心跳的时间间隔)
544func (s *Server) StartHeartBeat(interval time.Duration) {
545 checker := NewHeartbeatChecker(interval)
546
547 // Add the heartbeat check router. (添加心跳检测的路由)
548 //检测当前路由模式
549 if s.RouterSlicesMode {
550 s.AddRouterSlices(checker.MsgID(), checker.RouterSlices()...)
551 } else {
552 s.AddRouter(checker.MsgID(), checker.Router())
553 }
554
555 // Bind the heartbeat checker to the server. (server绑定心跳检测器)
556 s.hc = checker
557}
558
559// StartHeartBeatWithOption starts the heartbeat detection with the given configuration.
560// interval is the time interval for sending heartbeat messages.

Callers 1

mainFunction · 0.95

Calls 6

AddRouterSlicesMethod · 0.95
MsgIDMethod · 0.95
RouterSlicesMethod · 0.95
AddRouterMethod · 0.95
RouterMethod · 0.95
NewHeartbeatCheckerFunction · 0.85

Tested by

no test coverage detected