/// <summary> /// Handle deserialized packets /// </summary> /// <param name="sender">the tcp connection taht received the packet</param> /// <param name="packets">packet queue(queue will preserve order)</param> public void OnPacketsReceived(object sender, Queue <ProtocolPacket> packets) { TcpConnection connection = (TcpConnection)sender; while (packets.Count != 0) { ProtocolPacket packet = packets.Dequeue(); if (packet is GetRequest) { this.HandleGet(packet as GetRequest, connection); } else if (packet is SetRequest) { this.HandleSet(packet as SetRequest, connection); } else { Trace.TraceInformation("Unknown request {0}", packet.GetType().FullName); } } }