public async Task <BaseCommand> Send(CommandCloseProducer command) { var response = await SendRequestResponse(command.AsBaseCommand()); if (response.CommandType == BaseCommand.Type.Success) { _producerManager.Remove(command.ProducerId); } return(response); }
public async Task <BaseCommand> Send(CommandCloseProducer command, CancellationToken cancellationToken) { ThrowIfDisposed(); Task <BaseCommand>?responseTask; using (await _lock.Lock(cancellationToken).ConfigureAwait(false)) { responseTask = _channelManager.Outgoing(command); var sequence = Serializer.Serialize(command.AsBaseCommand()); await _stream.Send(sequence).ConfigureAwait(false); } return(await responseTask.ConfigureAwait(false)); }
public async Task <BaseCommand> Send(CommandCloseProducer command) { Task <BaseCommand>?responseTask = null; using (await _lock.Lock()) { var baseCommand = command.AsBaseCommand(); responseTask = _requestResponseHandler.Outgoing(baseCommand); _channelManager.Outgoing(command, responseTask); var sequence = Serializer.Serialize(baseCommand); await _stream.Send(sequence); } return(await responseTask); }