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; }
protected virtual bool RemoveServerReply(Client client, RemoveServerReply reply) { return true; }
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); } }
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); }