public async Task ProcessAsync(IClientPipeContext context, ReadOnlyMemory <IClientPipe> pipeline) { using var channelContainer = await _connectionManager.AcquireChannel(_channelType); try { context.ChannelContainer = channelContainer; await ProcessNextAsync(context, pipeline); } finally { context.ChannelContainer = null; } }
public async Task ProcessAsync(IClientPipeContext context, ReadOnlyMemory <IClientPipe> pipeline) { var channelContainer = await _connectionManager.AcquireChannel(_channelType); try { context.ChannelContainer = channelContainer; await ProcessNextAsync(context, pipeline); } catch { // Do not release channel except on error context.ChannelContainer = null; channelContainer.Dispose(); throw; } }