public string BroadcastDeadServersToServer(AckController ackController, IServer server, string url, string deadServer) { Console.WriteLine("going to send dead server {0}", deadServer); server.ReceiveDeadServers(deadServer); ackController.N_acks++; return(url); }
public string BroadcastUpdateLocationToServer(AckController ackController, IServer server, string url, Location location) { Console.WriteLine("going to send updated location {0}", location.Name); server.ReceiveUpdateLocation(location); ackController.N_acks++; return(url); }
public string BroadcastCloseToServer(AckController ackController, IServer server, string url, MeetingProposal proposal) { Console.WriteLine("going to send close {0}", proposal.Topic); server.ReceiveClose(proposal, _meetingsClocks[proposal.Topic]); ackController.N_acks++; return(url); }
public string BroadcastJoinToServer(AckController ackController, IServer server, string url, string username, MeetingProposal proposal, MeetingRecord record) { Console.WriteLine("going to send join {0}", proposal.Topic); server.ReceiveJoin(username, proposal, record, _meetingsClocks[proposal.Topic]); ackController.N_acks++; return(url); }
public string BroadcastNewMeetingToServer(AckController ackController, IServer server, string url, MeetingProposal proposal) { Console.WriteLine("going to inform server of new meeting {0}", proposal.Topic); server.ReceiveNewMeeting(proposal, _meetingsClocks[proposal.Topic]); ackController.N_acks++; return(url); }
//BROADCAST LOCATION public void BroadcastUpdateLocation(Location location) { AckController ackController = new AckController(); foreach (KeyValuePair <string, IServer> server in _servers) { _broadcastUpdateLocationDelegate.BeginInvoke(ackController, server.Value, server.Key, location, BroadcastUpdateLocationCallback, server.Key); } WaitForMaxFault(ackController); }
//BROADCAST DEAD SERVERS public void BroadcastDeadServers(string deadServer) { AckController ackController = new AckController(); foreach (KeyValuePair <string, IServer> server in _servers) { if (_serversStatus[server.Key] == false) { _broadcastDeadServersDelegate.BeginInvoke(ackController, server.Value, server.Key, deadServer, BroadcastDeadServersCallback, server.Key); } } WaitForMaxFault(ackController); }
//BROADCAST CLOSE public void BroadcastClose(MeetingProposal proposal) { AckController ackController = new AckController(); foreach (KeyValuePair <string, IServer> server in _servers) { if (_serversStatus[server.Key] == false) { _broadcastCloseDelegate.BeginInvoke(ackController, server.Value, server.Key, proposal, BroadcastCloseCallback, server.Key); } } WaitForMaxFault(ackController); }
//BROADCAST JOIN public void BroadcastJoin(string username, MeetingProposal proposal, MeetingRecord record) { AckController ackController = new AckController(); foreach (KeyValuePair <string, IServer> server in _servers) { if (_serversStatus[server.Key] == false) { _broadcastJoinDelegate.BeginInvoke(ackController, server.Value, server.Key, username, proposal, record, BroadcastJoinCallback, server.Key); } } WaitForMaxFault(ackController); }
public void WaitForMaxFault(AckController ackController) { //int n_acks = 0; while (true) { if (ackController.N_acks >= _maxFaults) { break; } //Console.WriteLine("acks " + ackController.N_acks); //Console.WriteLine("maxFaults " + _maxFaults); //int index = WaitHandle.WaitAny(ackController.Handles); //n_acks++; /*Console.WriteLine("index" + index); * * var list_handle = new List<WaitHandle>(ackController.Handles); * list_handle.RemoveAt(index); * ackController.Handles = list_handle.ToArray();*/ } }