private void StabilizeFromSuccessor(StabilizeReply reply)
            {
                _node.Log($"StabilizeFromSuccessor");
                _node.Predecessor = reply.Predecessor;
                _node.SuccessorTable.Copy(reply.SuccessorTableEntries);

                _commMgr.SendInternal(new InitRectify());
            }
 private void StabilizeFromPredecessor(StabilizeReply reply)
 {
     _node.Log($"StabilizeFromPredecessor");
     // The predecessor is a better successor than the current one.
     // We should quit this operation and stabilize against the precedessor
     _commMgr.SendInternal(new CancelOperation(reply.CorrelationId));
     Stabilize(reply.Predecessor);
     //_commMgr.SendInternal(new JoinToSeed {SeedNode = reply.Predecessor}); // this causes an infinite loop
 }
            public void Handle(Stabilize message)
            {
                _node.LogMessage(message);
                _commMgr.SendAck(message, message.CorrelationId);

                var reply = new StabilizeReply(_node.Identity, message.From, message.CorrelationId)
                {
                    Predecessor = _node.Predecessor,
                    // Take the opportunity to ensure the successor table is up to date.
                    SuccessorTableEntries = _node.SuccessorTable.Entries,
                };

                _node.Log($"Sending {reply.TypeName()} Id:{reply.CorrelationId}");
                _commMgr.Send(reply);
            }