Skip to content

Commit ba10eda

Browse files
author
Emile Joubert
committed
Use protocol value for reply success instead of hardcoded 200
1 parent bb199c5 commit ba10eda

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

projects/client/RabbitMQ.Client/src/client/api/ConnectionFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ namespace RabbitMQ.Client
8888
/// //
8989
/// // ... use ch's IModel methods ...
9090
/// //
91-
/// ch.Close(200, "Closing the channel");
92-
/// conn.Close(200, "Closing the connection");
91+
/// ch.Close(Constants.ReplySuccess, "Closing the channel");
92+
/// conn.Close(Constants.ReplySuccess, "Closing the connection");
9393
///</code></example>
9494
///<para>
9595
/// Please see also the API overview and tutorial in the User Guide.

projects/client/RabbitMQ.Client/src/client/impl/ConnectionBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ void IDisposable.Dispose()
369369
///<summary>API-side invocation of connection close.</summary>
370370
public void Close()
371371
{
372-
Close(200, "Goodbye", Timeout.Infinite);
372+
Close(CommonFraming.Constants.ReplySuccess, "Goodbye", Timeout.Infinite);
373373
}
374374

375375
///<summary>API-side invocation of connection close.</summary>
@@ -381,7 +381,7 @@ public void Close(ushort reasonCode, string reasonText)
381381
///<summary>API-side invocation of connection close with timeout.</summary>
382382
public void Close(int timeout)
383383
{
384-
Close(200, "Goodbye", timeout);
384+
Close(CommonFraming.Constants.ReplySuccess, "Goodbye", timeout);
385385
}
386386

387387
///<summary>API-side invocation of connection close with timeout.</summary>
@@ -410,7 +410,7 @@ public void Abort(ushort reasonCode, string reasonText)
410410
///<summary>API-side invocation of connection abort with timeout.</summary>
411411
public void Abort(int timeout)
412412
{
413-
Abort(200, "Connection close forced", timeout);
413+
Abort(CommonFraming.Constants.ReplySuccess, "Connection close forced", timeout);
414414
}
415415

416416
///<summary>API-side invocation of connection abort with timeout.</summary>

projects/client/RabbitMQ.Client/src/client/impl/ModelBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
using System;
5858
using System.IO;
5959
using System.Collections;
60+
using System.Diagnostics;
6061
using System.Threading;
6162

6263
using RabbitMQ.Client;
@@ -69,7 +70,6 @@
6970
// we support*. Obviously we may need to revisit this if that ever
7071
// changes.
7172
using CommonFraming = RabbitMQ.Client.Framing.v0_9;
72-
using System.Diagnostics;
7373

7474
namespace RabbitMQ.Client.Impl
7575
{
@@ -808,7 +808,7 @@ void IDisposable.Dispose()
808808

809809
public void Close()
810810
{
811-
Close(200, "Goodbye");
811+
Close(CommonFraming.Constants.ReplySuccess, "Goodbye");
812812
}
813813

814814
public void Close(ushort replyCode, string replyText)
@@ -818,7 +818,7 @@ public void Close(ushort replyCode, string replyText)
818818

819819
public void Abort()
820820
{
821-
Abort(200, "Goodbye");
821+
Abort(CommonFraming.Constants.ReplySuccess, "Goodbye");
822822
}
823823

824824
public void Abort(ushort replyCode, string replyText)

projects/client/RabbitMQ.Client/src/client/impl/SessionManager.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@
6262
using RabbitMQ.Client.Exceptions;
6363
using RabbitMQ.Util;
6464

65+
// We use spec version 0-9 for common constants such as frame types,
66+
// error codes, and the frame end byte, since they don't vary *within
67+
// the versions we support*. Obviously we may need to revisit this if
68+
// that ever changes.
69+
using CommonFraming = RabbitMQ.Client.Framing.v0_9;
70+
6571
namespace RabbitMQ.Client.Impl
6672
{
6773
public class SessionManager
@@ -203,7 +209,7 @@ public void CheckAutoClose()
203209
///when we decide to close the connection.</summary>
204210
public void AutoCloseConnection()
205211
{
206-
m_connection.Abort(200, "AutoClose", ShutdownInitiator.Library, Timeout.Infinite);
212+
m_connection.Abort(CommonFraming.Constants.ReplySuccess, "AutoClose", ShutdownInitiator.Library, Timeout.Infinite);
207213
}
208214
}
209215
}

0 commit comments

Comments
 (0)