コード例 #1
0
        public sealed override void Close()
        {
            base.Close();

            if (_ResponseReceivedQueue != null)
            {
                _ResponseReceivedQueue.Dispose();
                _ResponseReceivedQueue = null;
            }

            List <Message> awaiting = null;

            lock (_AwaitResponse)
            {
                awaiting = _AwaitResponse.Values.ToList();
                _AwaitResponse.Clear();
            }

            foreach (Message ar in awaiting)
            {
                StopWaiting(ar);

                ConnectionLost m = new ConnectionLost(ar.MessageID);

                m.MessageConnection = this;
                m.TimeSent          = m.TimeReceived = DateTime.UtcNow;

                try
                {
                    if (_ReceiveResponse != null)
                    {
                        _ReceiveResponse(this, ar, m);
                    }
                }
                catch { }
            }
        }
コード例 #2
0
        public sealed override void Close()
        {
            base.Close();

            if (_MessageReceivedQueue != null)
            {
                _MessageReceivedQueue.Dispose();
                _MessageReceivedQueue = null;
            }

            if (_ResponseReceivedQueue != null)
            {
                _ResponseReceivedQueue.Dispose();
                _ResponseReceivedQueue = null;
            }

            lock (_AwaitResponse)
            {
                foreach (Message ar in _AwaitResponse.Values.ToList())
                {
                    ConnectionLost m = new ConnectionLost(ar.MessageID);

                    m.MessageConnection = this;
                    m.TimeSent          = m.TimeReceived = DateTime.UtcNow;

                    try
                    {
                        if (_ReceiveResponse != null)
                        {
                            _ReceiveResponse(this, ar, m);
                        }
                    }
                    catch { }
                }
            }
        }