activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1061572 - /activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompWireFormat.cs
Date Thu, 20 Jan 2011 23:42:55 GMT
Author: tabish
Date: Thu Jan 20 23:42:55 2011
New Revision: 1061572

URL: http://svn.apache.org/viewvc?rev=1061572&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQNET-308

Modified:
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompWireFormat.cs

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompWireFormat.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompWireFormat.cs?rev=1061572&r1=1061571&r2=1061572&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompWireFormat.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompWireFormat.cs
Thu Jan 20 23:42:55 2011
@@ -32,6 +32,7 @@ namespace Apache.NMS.Stomp.Protocol
         private IPrimitiveMapMarshaler mapMarshaler = new XmlPrimitiveMapMarshaler();
         private ITransport transport;
         private WireFormatInfo remoteWireFormatInfo;
+        private int connectedResponseId = -1;
 
         public StompWireFormat()
         {
@@ -190,8 +191,6 @@ namespace Apache.NMS.Stomp.Protocol
 
         protected virtual Command ReadConnected(StompFrame frame)
         {
-            string responseId = frame.RemoveProperty("response-id");
-
             this.remoteWireFormatInfo = new WireFormatInfo();
 
             if(frame.HasProperty("version"))
@@ -222,11 +221,16 @@ namespace Apache.NMS.Stomp.Protocol
                 remoteWireFormatInfo.Version = 1.0f;
             }
 
-            if(responseId != null)
+            if(this.connectedResponseId != -1)
             {
                 Response answer = new Response();
-                answer.CorrelationId = Int32.Parse(responseId);
+                answer.CorrelationId = this.connectedResponseId;
                 SendCommand(answer);
+                this.connectedResponseId = -1;
+            }
+            else
+            {
+                throw new IOException("Received Connected Frame without a set Response Id
for it.");
             }
 
             return remoteWireFormatInfo;
@@ -442,9 +446,14 @@ namespace Apache.NMS.Stomp.Protocol
             StompFrame frame = new StompFrame("CONNECT");
 
             frame.SetProperty("client-id", command.ClientId);
-            frame.SetProperty("login", command.UserName);
-            frame.SetProperty("passcode", command.Password);
-            frame.SetProperty("request-id", command.CommandId);
+            if(!String.IsNullOrEmpty(command.UserName))
+            {
+                frame.SetProperty("login", command.UserName);
+            }
+            if(!String.IsNullOrEmpty(command.Password))
+            {
+                frame.SetProperty("passcode", command.Password);
+            }
             frame.SetProperty("host", command.Host);
             frame.SetProperty("accept-version", "1.0,1.1");
 
@@ -458,6 +467,8 @@ namespace Apache.NMS.Stomp.Protocol
                 Tracer.Debug("StompWireFormat - Writing " + frame.ToString());
             }
 
+            this.connectedResponseId = command.CommandId;
+
             frame.ToStream(dataOut);
         }
 



Mime
View raw message