diff --git a/znet/heartbeat.go b/znet/heartbeat.go index 18ab2f07..4cb758b7 100644 --- a/znet/heartbeat.go +++ b/znet/heartbeat.go @@ -173,10 +173,14 @@ func (h *HeartbeatChecker) Clone() ziface.IHeartbeatChecker { onRemoteNotAlive: h.onRemoteNotAlive, msgID: h.msgID, router: h.router, - routerSlices: h.routerSlices, conn: nil, // The bound connection needs to be reassigned } + // deep copy routerSlices + for _, handler := range h.routerSlices { + heartbeat.routerSlices = append(heartbeat.routerSlices, handler) + } + return heartbeat }