Exemplo n.º 1
0
        private Packet GetPacket(System.Timers.Timer checkTimer, System.Timers.Timer initializeTimer)
        {
            Packet packet = _user.DequeueReceive();

            if (packet?.RequestType == (byte)PacketType.Suspend)
            {
                lock (_processList)
                {
                    foreach (ServerProcess process in _processList) //send Suspend packet to all processes
                    {
                        process.EnqueueProcessQueue(packet);
                    }
                }

                _serverCommunicator.OperationState = false;
                //              SuspendCommunicator(_serverCommunicator); //close the communicator
                packet = null; //return null
            }

            initializeTimer.Stop();
            checkTimer.Stop();
            checkTimer.Start(); // Resets timer

            return(packet);
        }