Exemple #1
0
 private void SendJoinTable(JoinTable packet)
 {
     foreach (var nnode in NodeScanner.GetNearbyNodes(this, AllNodes))
     {
         new Thread(() =>
         {
             int timeElapsed = 0;
             Thread.Sleep((int)(nnode.Key * 10) - timeElapsed);
             timeElapsed += (int)(nnode.Key * 10);
             Thread.CurrentThread.IsBackground = true;
             nnode.Value.ReceiveJoinTablePacket(packet);
             OnPacketSent(packet, new EventArgs());
         }).Start();
     }
 }
Exemple #2
0
 private void SendData(DataPacket packet)
 {
     foreach (var nnode in NodeScanner.GetNearbyNodes(this, AllNodes))
     {
         int timeElapsed = 0;
         new Thread(() =>
         {
             Thread.Sleep((int)(nnode.Key * 10) - timeElapsed);
             timeElapsed += (int)(nnode.Key * 10);
             Thread.CurrentThread.IsBackground = true;
             nnode.Value.SendMessage(packet);
             OnPacketSent(packet, new EventArgs());
         }).Start();
     }
 }