Beispiel #1
0
        private void ProcessMsg(RecvMessage msg)
        {
            try
            {
                _stopwatch.Start();
                _logger.DebugFormat("ProcessRecvQueue msg {0}", msg.Type);
                MessageReceived(msg.Channel, msg.Type, msg.msg);
            }
            catch (Exception e)
            {
                _logger.ErrorFormat("ProcessRecvQueue error {0} {1}", IdInfo(), e);
            }
            finally
            {
                _stopwatch.Stop();
                var time = _stopwatch.ElapsedTicks / 10000f;
                if (time > 2)
                {
                    _logger.InfoFormat("ProcessRecvQueue {0} too long  {1} {2}", msg.Type, time, msg.Channel);
                }

                _stopwatch.Reset();
                if (msg.msg is IRefCounter)
                {
                    (msg.msg as IRefCounter).ReleaseReference();
                }
            }
        }
Beispiel #2
0
        public int ProcessRecvQueue()
        {
            int count = 0;

            _logger.DebugFormat("ProcessRecvQueue  start  {0} ", _recvQueue.Count);
            while (_recvQueue.Count > 0)
            {
                count++;
                RecvMessage msg = (RecvMessage)_recvQueue.Dequeue();
                ProcessMsg(msg);
            }

            _logger.DebugFormat("ProcessRecvQueue  end  {0} ", _recvQueue.Count);

            return(count);
        }