public void SendMessage(Message message) { lock (neighbors) foreach (var neighbor in neighbors) { if (message is UserMessage) Interlocked.Increment(ref outgoingPacketIndex); foreach (var endPoint in neighbor.IpEndPoints) { var sender = new Sender(endPoint, peerId) { RsaKeyStore = RsaKeyStore }; sender.SendMessage(message, message is UserMessage ? (ulong)outgoingPacketIndex : 0); } } }
public void SendMessage(IPEndPoint endPoint, Message message) { var sender = new Sender(endPoint, peerId) { RsaKeyStore = RsaKeyStore }; sender.SendMessage(message, message is UserMessage ? (ulong)Interlocked.Increment(ref outgoingPacketIndex) : 0); }
public void SendBroadcastMessage(Message message) { var sender = new Sender(broadcastPort, peerId) { RsaKeyStore = RsaKeyStore}; sender.SendMessage(message, 0); }