/// <summary>
        /// Cancels any pending operations like reading or writing messages.
        /// This method will block and not return until all outstanding operations have finished.
        /// </summary>
        public void Cancel()
        {
            _connection.Cancel();
            _objectStream.Cancel();

            if (_keepAliveTimer != null)
            {
                _keepAliveTimer.Stop();
            }
        }
Пример #2
0
        /// <summary>
        /// Stops the message reading and dispatching on the current message object stream.
        /// </summary>
        public void Stop()
        {
            lock (_syncLock)
            {
                if (_messageReaderThread == null)
                {
                    return;
                }

                _messageObjectStream.Cancel();
                _threadDownEvent.WaitOne();

                _messageObjectStream = null;
                _messageReaderThread = null;
            }
        }
        /// <summary>
        /// Stops the message reading and dispatching on the current message object stream.
        /// </summary>
        public void Stop()
        {
            lock (_syncLock)
            {
                if (_messageReaderThread == null)
                {
                    return;
                }

                this.Trace("Stopping the message reading and dispatching on the current message object stream.");

                _messageObjectStream.Cancel();
                _threadDownEvent.WaitOne();

                _messageObjectStream = null;
                _messageReaderThread = null;

                this.Trace("The message reading and dispatching on the current message object stream are stopped.");
            }
        }