public void SendLogNMessages(string meeting_topic, List <string> client_addresses) { Console.WriteLine("Propagating \"" + meeting_topic + "\" to log2(" + client_addresses.Count + ") servers."); int number_clients = client_addresses.Count; if (number_clients != 0) { double clients_double = Convert.ToDouble(number_clients); double clients_log = Math.Log(clients_double, 2); // se for 0 e porque so havia um if (clients_log != 0) { double log_round = Math.Ceiling(clients_log); string[] random_clients = this.PickNRandomClients((int)log_round, client_addresses); for (int i = 0; i < random_clients.Length; i++) { ClientInterface client = (ClientInterface)Activator.GetObject(typeof(ClientInterface), "tcp://" + random_clients[i]); SendMeetingToClientGossipAsyncDelegate RemoteDel = new SendMeetingToClientGossipAsyncDelegate(client.SendMeetingGossip); AsyncCallback RemoteCallback = new AsyncCallback(ClientCommunication.SendMeetingToClientGossipAsyncCallBack); IAsyncResult RemAr = RemoteDel.BeginInvoke(meeting_topic, 1, "OPEN", null, client_addresses, RemoteCallback, null); } } } Console.WriteLine("Propagation was successfully done!"); }
public static void SendMeetingToClientGossipAsyncCallBack(IAsyncResult ar) { SendMeetingToClientGossipAsyncDelegate del = (SendMeetingToClientGossipAsyncDelegate)((AsyncResult)ar).AsyncDelegate; return; }