Skip to content

Commit

Permalink
Merge pull request #294 from aceld/fix/issue#293_aceld
Browse files Browse the repository at this point in the history
fix issue routerSlice deep copy
  • Loading branch information
aceld authored Dec 18, 2023
2 parents 37b8d8e + 4b613bc commit 64edb1b
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 64edb1b

Please sign in to comment.