@@ -55,7 +55,6 @@ internal partial class Channel : IChannel, IRecoverable
55
55
// AMQP only allows one RPC operation to be active at a time.
56
56
protected readonly SemaphoreSlim _rpcSemaphore = new SemaphoreSlim ( 1 , 1 ) ;
57
57
private readonly RpcContinuationQueue _continuationQueue = new RpcContinuationQueue ( ) ;
58
- private readonly AsyncManualResetEvent _flowControlBlock = new AsyncManualResetEvent ( true ) ;
59
58
60
59
private ShutdownEventArgs ? _closeReason ;
61
60
public ShutdownEventArgs ? CloseReason => Volatile . Read ( ref _closeReason ) ;
@@ -361,11 +360,14 @@ protected bool Enqueue(IRpcContinuation k)
361
360
}
362
361
}
363
362
364
- internal async Task < IChannel > OpenAsync ( bool publisherConfirmationsEnabled = false ,
365
- bool publisherConfirmationTrackingEnabled = false ,
366
- CancellationToken cancellationToken = default )
363
+ internal async Task < IChannel > OpenAsync ( bool publisherConfirmationsEnabled ,
364
+ bool publisherConfirmationTrackingEnabled ,
365
+ ushort ? maxOutstandingPublisherConfirmations ,
366
+ CancellationToken cancellationToken )
367
367
{
368
- ConfigurePublisherConfirmations ( publisherConfirmationsEnabled , publisherConfirmationTrackingEnabled ) ;
368
+ ConfigurePublisherConfirmations ( publisherConfirmationsEnabled ,
369
+ publisherConfirmationTrackingEnabled ,
370
+ maxOutstandingPublisherConfirmations ) ;
369
371
370
372
bool enqueued = false ;
371
373
var k = new ChannelOpenAsyncRpcContinuation ( ContinuationTimeout , cancellationToken ) ;
@@ -450,17 +452,6 @@ protected ValueTask ModelSendAsync<TMethod, THeader>(in TMethod method, in THead
450
452
return Session . TransmitAsync ( in method , in header , body , cancellationToken ) ;
451
453
}
452
454
453
- [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
454
- protected ValueTask EnforceFlowControlAsync ( CancellationToken cancellationToken )
455
- {
456
- if ( _flowControlBlock . IsSet )
457
- {
458
- return default ;
459
- }
460
-
461
- return _flowControlBlock . WaitAsync ( cancellationToken ) ;
462
- }
463
-
464
455
internal Task OnCallbackExceptionAsync ( CallbackExceptionEventArgs args )
465
456
{
466
457
return _callbackExceptionAsyncWrapper . InvokeAsync ( this , args ) ;
@@ -540,7 +531,8 @@ protected virtual void Dispose(bool disposing)
540
531
541
532
ConsumerDispatcher . Dispose ( ) ;
542
533
_rpcSemaphore . Dispose ( ) ;
543
- _confirmSemaphore ? . Dispose ( ) ;
534
+ _confirmSemaphore . Dispose ( ) ;
535
+ _maxOutstandingConfirmationsSemaphore ? . Dispose ( ) ;
544
536
}
545
537
}
546
538
@@ -561,7 +553,8 @@ protected virtual async ValueTask DisposeAsyncCore()
561
553
562
554
ConsumerDispatcher . Dispose ( ) ;
563
555
_rpcSemaphore . Dispose ( ) ;
564
- _confirmSemaphore ? . Dispose ( ) ;
556
+ _confirmSemaphore . Dispose ( ) ;
557
+ _maxOutstandingConfirmationsSemaphore ? . Dispose ( ) ;
565
558
}
566
559
567
560
public Task ConnectionTuneOkAsync ( ushort channelMax , uint frameMax , ushort heartbeat , CancellationToken cancellationToken )
0 commit comments