public void SetError(ProtoChannelException exception)
 {
     foreach (var message in _pendingMessages.Values)
     {
         message.SetAsCompleted(exception, false);
     }
 }
 public void SetError(ProtoChannelException exception)
 {
     foreach (var stream in _streams.Values)
     {
         stream.SetAsFailed(exception);
     }
 }
Esempio n. 3
0
        private void ProcessErrorPackage(PendingPackage package)
        {
            var error = (Messages.Error)ReadMessage(
                TypeModel, typeof(Messages.Error), (int)package.Length
            );

            var exception = new ProtoChannelException((ProtocolError)error.ErrorNumber);

            _messageManager.SetError(exception);
            _receiveStreamManager.SetError(exception);

            RaiseUnhandledException(exception);

            Dispose();
        }
Esempio n. 4
0
        protected override void Dispose(bool disposing)
        {
            lock (SyncRoot)
            {
                if (!_disposed && disposing)
                {
                    // Cancel all outstanding requests.

                    var disconnectException = new ProtoChannelException("Channel disconnected");

                    _messageManager.SetError(disconnectException);
                    _receiveStreamManager.SetError(disconnectException);

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

                    _disposed = true;
                }
            }

            base.Dispose(disposing);
        }