summaryrefslogtreecommitdiff
path: root/dotnet/Qpid.Client/Client/Handler/ConnectionCloseMethodHandler.cs
diff options
context:
space:
mode:
authorRobert Greig <rgreig@apache.org>2007-01-29 10:46:27 +0000
committerRobert Greig <rgreig@apache.org>2007-01-29 10:46:27 +0000
commit2bcc371558ce0659f53b86046cdf3d5de3b20910 (patch)
treed0c987cfa076eb90edb80620661d69a6e7354d3a /dotnet/Qpid.Client/Client/Handler/ConnectionCloseMethodHandler.cs
parentfe736211136b60bec61c1a22d3765be9142c6b39 (diff)
downloadqpid-python-2bcc371558ce0659f53b86046cdf3d5de3b20910.tar.gz
(Patch supplied by Tomas Restrepo) QPID-291-2.diff applied. Adds SASL capability to the .Net client.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@501001 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dotnet/Qpid.Client/Client/Handler/ConnectionCloseMethodHandler.cs')
-rw-r--r--dotnet/Qpid.Client/Client/Handler/ConnectionCloseMethodHandler.cs25
1 files changed, 20 insertions, 5 deletions
diff --git a/dotnet/Qpid.Client/Client/Handler/ConnectionCloseMethodHandler.cs b/dotnet/Qpid.Client/Client/Handler/ConnectionCloseMethodHandler.cs
index c3acc0b098..dea5316d25 100644
--- a/dotnet/Qpid.Client/Client/Handler/ConnectionCloseMethodHandler.cs
+++ b/dotnet/Qpid.Client/Client/Handler/ConnectionCloseMethodHandler.cs
@@ -19,10 +19,12 @@
*
*/
using System;
+using System.Threading;
using log4net;
using Qpid.Client.Protocol;
using Qpid.Client.State;
using Qpid.Framing;
+using Qpid.Protocol;
namespace Qpid.Client.Handler
{
@@ -38,16 +40,29 @@ namespace Qpid.Client.Handler
int errorCode = method.ReplyCode;
String reason = method.ReplyText;
+ // send CloseOK
evt.ProtocolSession.WriteFrame(ConnectionCloseOkBody.CreateAMQFrame(evt.ChannelId));
- stateManager.ChangeState(AMQState.CONNECTION_CLOSED);
- if (errorCode != 200)
+
+ if ( errorCode != AMQConstant.REPLY_SUCCESS.Code )
{
- _logger.Debug("Connection close received with error code " + errorCode);
- throw new AMQConnectionClosedException(errorCode, "Error: " + reason);
- }
+ if ( errorCode == AMQConstant.NOT_ALLOWED.Code )
+ {
+ _logger.Info("Authentication Error: " + Thread.CurrentThread.Name);
+ evt.ProtocolSession.CloseProtocolSession();
+
+ //todo this is a bit of a fudge (could be conssidered such as each new connection needs a new state manager or at least a fresh state.
+ stateManager.ChangeState(AMQState.CONNECTION_NOT_STARTED);
+ throw new AMQAuthenticationException(errorCode, reason);
+ } else
+ {
+ _logger.Info("Connection close received with error code " + errorCode);
+ throw new AMQConnectionClosedException(errorCode, "Error: " + reason);
+ }
+ }
// this actually closes the connection in the case where it is not an error.
evt.ProtocolSession.CloseProtocolSession();
+ stateManager.ChangeState(AMQState.CONNECTION_CLOSED);
}
}
}