Ejemplo n.º 1
0
 public void processQueuedPackets(Object threadContext)
 {
     lock (queuedPackets)
     {
         if (playerSession == null) //no player why even bother?.
         {
             return;
         }
         if (queuedPackets.Count == 0)
         {
             return;
         }
         try //Exception occurs when it hits zero elements.
         {
             Packet p = null;
             while (queuedPackets.Count > 0)
             {
                 p = queuedPackets.Dequeue();
                 if (p != null && playerSession != null)
                 {
                     PacketHandlers.handlePacket(playerSession, p);
                 }
             }
         }
         catch (InvalidOperationException) { }
     }
 }
Ejemplo n.º 2
0
 public void processQueuedPackets()
 {
     lock (queuedPackets)
     {
         if (player == null) //no player why even bother?.
         {
             runningThread = false;
             return;
         }
         if (queuedPackets.Count == 0)
         {
             runningThread = false;
             return;
         }
         try //Exception occurs when it hits zero elements.
         {
             Packet packet = null;
             while (queuedPackets.Count > 0)
             {
                 packet = queuedPackets.Dequeue();
                 if (packet != null && player != null)
                 {
                     PacketHandlers.handlePacket(player, packet);
                 }
             }
         }
         catch (InvalidOperationException ioe)
         {
             Console.WriteLine("Packet Queue IOE Exception: " + ioe.Message);
         }
         catch (Exception e)
         {
             Console.WriteLine("Packet Queue Exception: " + e.Message);
         }
         runningThread = false;
     }
 }