static void ProcessNotifyClockQueue(PseudoTcpSocket conn, Queue notifyClockQueue) { PLog.DEBUG("Entering ProcessNotifyClockQueue with queue size={0}", notifyClockQueue.Count); if (notifyClockQueue.Count != 0) { PLog.DEBUG("...and head timestamp={0}, current time={1}", notifyClockQueue.Peek(), Environment.TickCount); } if (notifyClockQueue.Count == 0) { UdpCallbacks.AdjustClock(conn, notifyClockQueue); return; } bool keepChecking = true; while (keepChecking && notifyClockQueue.Count > 0) { int iTimestamp = (int)notifyClockQueue.Peek(); if (Environment.TickCount > iTimestamp) { SyncPseudoTcpSocket.NotifyClock(conn); notifyClockQueue.Dequeue(); } else { keepChecking = false; } } }
public void MessageReceived(IAsyncResult ar) { // Can happen during shutdown if (false == this.underlyingSock.Connected) { return; } byte[] receiveBytes = udpc.EndReceive(ar, ref endReceiveRemoteEP); PLog.DEBUG("Received {0} bytes from {1}", receiveBytes.Length, endReceiveRemoteEP); SyncPseudoTcpSocket.NotifyPacket(pseudoSock, receiveBytes, (uint)receiveBytes.Length); SyncPseudoTcpSocket.NotifyClock(pseudoSock); BeginReceive(); // Listen again }