fix: use 'parent' as mainPeer in PeerPacket in removePeerFromCurrentTree()
We've removed 'peer' from current tree, and ScheduleChildren() set
'parent' as parent of peers in 'children', so we should inform children
that 'parent' is the destination peer, not the removed 'peer'.
Fixes:
@@ -420,7 +420,7 @@ func removePeerFromCurrentTree(peer *supervisor.Peer, s *state) {
if ok {
children := s.sched.ScheduleChildren(parent, sets.NewString(peer.ID))
for _, child := range children {
- if err := child.SendSchedulePacket(constructSuccessPeerPacket(child, peer, nil)); err != nil {
+ if err := child.SendSchedulePacket(constructSuccessPeerPacket(child, parent, nil)); err != nil {
sendErrorHandler(err, s, child)
}
}
