예제 #1
0
        private async Task <Message> ReceiveMessageAsync(CancellationToken ct)
        {
            Message message;

            try {
                message = await _transport.ReceiveAsync(ct);
            } catch (MessageTransportException ex) when(ct.IsCancellationRequested)
            {
                // Network errors during cancellation are expected, but should not be exposed to clients.
                throw new OperationCanceledException(new OperationCanceledException().Message, ex);
            }

            if (message != null)
            {
                _log.Response(message.ToString(), _rLoopDepth);
            }

            return(message);
        }