public override void run() { for (Packet packet = packetQueue.dequeue(); packet != null; packet = packetQueue.dequeue()) { Packet child; String matchString; JabberServer.output.WriteLine("Receiving packet: " + packet.ToString()); if (packet.Element.Equals("iq", StringComparison.OrdinalIgnoreCase)) { child = packet.getFirstChild("query"); if (child == null) { matchString = "jabber:iq:register"; } else { matchString = child.Namespace; } } else { matchString = packet.Element; } if (matchString.Equals("terminate")) { saveToFile(); JabberServer.output.Close(); return; } try { lock (packetListeners) { foreach (PacketListener listener in packetListeners[matchString]) { listener.notify(packet); } } } catch (Exception ex) { JabberServer.output.WriteLine("Exception in QueueThread: " + ex.ToString()); } // try/catch 1 try { lock (packetListeners) { foreach (PacketListener listener in packetListeners[""]) { listener.notify(packet); } } } catch (Exception ex) { } // try/catch 2 } // for }
// Outputs any packets saved during the collapsing process static void outputSaved(ref int packetnum, ref int signalErrors, CollapseInfo collapseInfo, PacketQueue pktQ) { usbPrintSummaryPacket(ref packetnum, collapseInfo, ref signalErrors); PacketInfo pkt = pktQ.dequeue(); while (pkt != null) { usbPrintPacket(packetnum, pkt, null); packetnum += 1; // Get the next packet or null if empty pkt = pktQ.dequeue(); } }