private static void SendBroadcast(IRequestCommand command, IPAddress excludedConnection) { if (command == null) throw new ArgumentNullException("command"); foreach (Connection connection in m_Connections.Values) if (connection.IsEstablished && !connection.RemoteEndPoint.Address.Equals(excludedConnection)) command.Send(connection); }
private static void SendBroadcast(IRequestCommand command, IPAddress excludedConnection, int dropChainTailCount) { if (command == null) throw new ArgumentNullException("command"); try { m_Connections.Lock(); RList<Connection> connections = new RList<Connection>(); foreach (Connection connection in m_Connections.Values) if (connection.IsEstablished && !connection.RemoteEndPoint.Address.Equals(excludedConnection)) connections.Add(connection); dropChainTailCount = Math.Min(dropChainTailCount, connections.Count); for (int n = 0; n < dropChainTailCount; n++) { int index = Randomizer.GenerateNumber(0, connections.Count); command.Send(connections[index]); connections.RemoveAt(index); } } finally { m_Connections.Unlock(); } }
private static void SendBroadcast(IRequestCommand command) { if (command == null) throw new ArgumentNullException("command"); foreach (Connection connection in m_Connections.Values) if (connection.IsEstablished) command.Send(connection); }