示例#1
0
        private async Task AcceptAsync(ITransmissionConnection c)
        {
            try
            {
                await _buffer.WriteAsync(_connectionFactory.Create(c), CancellationToken).ConfigureAwait(false);

                Log.Debug("New connection accepted");
            }
            catch
            {
                await c.DisconnectAsync().IgnoreExceptions().ConfigureAwait(false);

                throw;
            }
        }
        private async Task HandleResponseMessageAsync(TResponse msg)
        {
            var header = _protocol.MessageFactory.CreateInvocationMessageReceived();

            if (!_sender.TryWrite(header))
            {
                await _sender.WriteOrDisposeAsync(header, CancellationToken).ConfigureAwait(false);
            }
            Log.Debug("Sent confirmation about received response of type {0}", msg.GetType().Name);
            if (!_responses.TryWrite(msg))
            {
                await _responses.WriteAsync(msg, CancellationToken).ConfigureAwait(false);
            }
            Log.Debug("Consumed response of type {0}", msg.GetType().Name);
        }