Skip to content

Commit 66f0e41

Browse files
committed
Cleanup session interface and base
1 parent e6e8b5c commit 66f0e41

File tree

3 files changed

+5
-30
lines changed

3 files changed

+5
-30
lines changed

projects/RabbitMQ.Client/client/impl/ChannelBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ internal async Task FinishCloseAsync(CancellationToken cancellationToken)
408408
ShutdownEventArgs? reason = CloseReason;
409409
if (reason != null)
410410
{
411-
await Session.CloseAsync(reason, cancellationToken)
411+
await Session.CloseAsync(reason)
412412
.ConfigureAwait(false);
413413
}
414414

@@ -664,7 +664,7 @@ protected async Task<bool> HandleChannelCloseAsync(IncomingCommand cmd, Cancella
664664
channelClose._classId,
665665
channelClose._methodId));
666666

667-
await Session.CloseAsync(_closeReason, false, cancellationToken)
667+
await Session.CloseAsync(_closeReason, notify: false)
668668
.ConfigureAwait(false);
669669

670670
var method = new ChannelCloseOk();

projects/RabbitMQ.Client/client/impl/ISession.cs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,39 +41,19 @@ namespace RabbitMQ.Client.Impl
4141

4242
internal interface ISession
4343
{
44-
/// <summary>
45-
/// Gets the channel number.
46-
/// </summary>
4744
ushort ChannelNumber { get; }
4845

49-
/// <summary>
50-
/// Gets the close reason.
51-
/// </summary>
5246
ShutdownEventArgs? CloseReason { get; }
5347

54-
///<summary>
55-
/// Single recipient - no need for multiple handlers to be informed of arriving commands.
56-
///</summary>
5748
CommandReceivedAction? CommandReceived { get; set; }
5849

59-
/// <summary>
60-
/// Gets the connection.
61-
/// </summary>
6250
Connection Connection { get; }
6351

64-
/// <summary>
65-
/// Gets a value indicating whether this session is open.
66-
/// </summary>
6752
bool IsOpen { get; }
6853

69-
///<summary>
70-
/// Multicast session shutdown event.
71-
///</summary>
7254
event AsyncEventHandler<ShutdownEventArgs> SessionShutdownAsync;
7355

74-
Task CloseAsync(ShutdownEventArgs reason, CancellationToken cancellationToken);
75-
76-
Task CloseAsync(ShutdownEventArgs reason, bool notify, CancellationToken cancellationToken);
56+
Task CloseAsync(ShutdownEventArgs reason, bool notify = true);
7757

7858
Task HandleFrameAsync(InboundFrame frame, CancellationToken cancellationToken);
7959

projects/RabbitMQ.Client/client/impl/SessionBase.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,7 @@ public override string ToString()
9292
return $"{GetType().Name}#{ChannelNumber}:{Connection}";
9393
}
9494

95-
public Task CloseAsync(ShutdownEventArgs reason, CancellationToken cancellationToken)
96-
{
97-
return CloseAsync(reason, true, cancellationToken);
98-
}
99-
100-
public Task CloseAsync(ShutdownEventArgs reason, bool notify, CancellationToken cancellationToken)
95+
public Task CloseAsync(ShutdownEventArgs reason, bool notify = true)
10196
{
10297
if (Interlocked.CompareExchange(ref _closeReason, reason, null) is null)
10398
{
@@ -155,7 +150,7 @@ public ValueTask TransmitAsync<TMethod, THeader>(in TMethod cmd, in THeader head
155150

156151
private Task OnConnectionShutdownAsync(object? conn, ShutdownEventArgs reason)
157152
{
158-
return CloseAsync(reason, CancellationToken.None);
153+
return CloseAsync(reason);
159154
}
160155

161156
private Task OnSessionShutdownAsync(ShutdownEventArgs reason)

0 commit comments

Comments
 (0)