Exemplo n.º 1
0
 void PacketHandler()
 {
     new Thread(() =>
     {
         while (!Disposed)
         {
             try
             {
                 if (PacketQueue.TryDequeue(out Packet packet))
                 {
                     OperationQueue.Enqueue(new Operation(GetPeer(packet.EndPoint), packet));
                 }
                 else
                 {
                     PacketQueueBegin.Reset(); PacketQueueBegin.WaitOne();
                 }
             }
             catch (Exception e)
             {
                 OnException(e);
             }
         }
         Console.WriteLine("Packet manager disposed");
     }).Start();
 }
Exemplo n.º 2
0
 public void EnqueuePacket(Packet packet)
 {
     PacketQueueBegin.Set();
     PacketQueue.Enqueue(packet);
 }