Skip to content

Commit

Permalink
fix issue routerSlice deep copy #293
Browse files Browse the repository at this point in the history
  • Loading branch information
aceld committed Dec 18, 2023
1 parent 37b8d8e commit 4b613bc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion znet/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 4b613bc

Please sign in to comment.