Пример #1
0
 protected override bool RemoveServerReply(Client client, RemoveServerReply reply)
 {
     if (client == null)
         Console.WriteLine("{0}: Server {1} replied with not leader and doesn't know who is the leader", _server.Name, reply.From);
     else
     {
         if (reply.Status == RemoveServerStatus.Ok)
         {
             client.RpcDue = 0;
             Console.WriteLine("{0}: Removed from cluster, stopping", _server.Name);
             _server.ChangeState(new StoppedState(_server));
         }
     }
     return true;
 }
Пример #2
0
 protected virtual bool RemoveServerReply(Client client, RemoveServerReply reply)
 {
     return true;
 }
Пример #3
0
 public bool RemoveServerReply(RemoveServerReply reply)
 {
     if (reply.Status == RemoveServerStatus.NotLeader && reply.LeaderHint == null)
     {
         return RemoveServerReply(null, reply);
     }
     else
     {
         var client = new Client(_server, reply.LeaderHint);
         return RemoveServerReply(client, reply);
     }
 }
Пример #4
0
 public void SendRemoveServerReply(RemoveServerStatus status, IPEndPoint leaderHint)
 {
     Console.WriteLine("{0}: Sending remove server reply to {1} with status {2}", _server.Name, ID, status);
     var message = new RemoveServerReply()
     {
         From = _server.ID,
         Status = status,
         LeaderHint = leaderHint,
     };
     _lastMessage = message;
     _server.Transport.SendMessage(this, message);
 }