You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jg...@apache.org on 2009/06/11 23:56:49 UTC

svn commit: r783935 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0: ./ deploy/ nant-common.xml src/main/csharp/Transport/Discovery/Multicast/MulticastDiscoveryAgent.cs vs2008-activemq-test.csproj vs2008-activemq.csproj vs2008-activemq.sln

Author: jgomes
Date: Thu Jun 11 21:56:48 2009
New Revision: 783935

URL: http://svn.apache.org/viewvc?rev=783935&view=rev
Log:
Merged fix into 1.1.0 branch.
Fixes [AMQNET-163]. (See https://issues.apache.org/activemq/browse/AMQNET-163)

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/   (props changed)
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/deploy/   (props changed)
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/nant-common.xml   (props changed)
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/src/main/csharp/Transport/Discovery/Multicast/MulticastDiscoveryAgent.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/vs2008-activemq-test.csproj   (props changed)
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/vs2008-activemq.csproj   (props changed)
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/vs2008-activemq.sln   (props changed)

Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jun 11 21:56:48 2009
@@ -1 +1,2 @@
 /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.0.0:692591,693525
+/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk:783798

Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/deploy/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jun 11 21:56:48 2009
@@ -0,0 +1 @@
+/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/deploy:783798

Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/nant-common.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jun 11 21:56:48 2009
@@ -0,0 +1 @@
+/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/nant-common.xml:783798

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/src/main/csharp/Transport/Discovery/Multicast/MulticastDiscoveryAgent.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/src/main/csharp/Transport/Discovery/Multicast/MulticastDiscoveryAgent.cs?rev=783935&r1=783934&r2=783935&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/src/main/csharp/Transport/Discovery/Multicast/MulticastDiscoveryAgent.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/src/main/csharp/Transport/Discovery/Multicast/MulticastDiscoveryAgent.cs Thu Jun 11 21:56:48 2009
@@ -32,7 +32,7 @@
 		public const int MAX_SOCKET_CONNECTION_RETRY_ATTEMPS = 3;
 		public const int DEFAULT_BACKOFF_MILLISECONDS = 100;
 		public const int BACKOFF_MULTIPLIER = 2;
-		public const string DEFAULT_DISCOVERY_URI_STRING = "multicast://localhost:6155";
+        public const string DEFAULT_DISCOVERY_URI_STRING = "multicast://239.255.2.3:6155";
 		private const string TYPE_SUFFIX = "ActiveMQ-4.";
 		private const string ALIVE = "alive";
 		private const string DEAD = "dead";
@@ -46,7 +46,7 @@
 		private string group;
 		private object stopstartSemaphore = new object();
 		private bool isStarted = false;
-		private readonly Uri discoveryUri;
+		private Uri discoveryUri;
 		private Socket multicastSocket;
 		private IPEndPoint endPoint;
 		private Thread worker;
@@ -61,7 +61,6 @@
 
 		public MulticastDiscoveryAgent()
 		{
-			discoveryUri = new Uri(DEFAULT_DISCOVERY_URI_STRING);
 			group = DEFAULT_GROUP;
 			remoteBrokers = new Dictionary<string, RemoteBrokerData>();
 		}
@@ -70,6 +69,11 @@
 		{
 			lock(stopstartSemaphore)
 			{
+                if (discoveryUri == null)
+                {
+                    discoveryUri = new Uri(DEFAULT_DISCOVERY_URI_STRING);
+                }
+
 				if(multicastSocket == null)
 				{
 					int numFailedAttempts = 0;
@@ -177,8 +181,17 @@
 				{
 					int numBytes = multicastSocket.Receive(buffer);
 					receivedInfoRaw = System.Text.Encoding.UTF8.GetString(buffer, 0, numBytes);
-					// We have to remove all of the null bytes.
-					receivedInfo = receivedInfoRaw.Substring(0, receivedInfoRaw.IndexOf("\0"));
+					// We have to remove all of the null bytes if there are any otherwise we just
+                    // take the whole string as is.
+                    if (receivedInfoRaw.IndexOf("\0") != -1)
+                    {
+                        receivedInfo = receivedInfoRaw.Substring(0, receivedInfoRaw.IndexOf("\0"));
+                    }
+                    else
+                    {
+                        receivedInfo = receivedInfoRaw;
+                    }
+
 					ProcessBrokerMessage(receivedInfo);
 				}
 				catch(SocketException)
@@ -281,6 +294,17 @@
 			}
 		}
 
+        #region Properties
+
+        /// <summary>
+        /// This property indicates whether or not async send is enabled.
+        /// </summary>
+        public Uri DiscoveryURI
+        {
+            get { return discoveryUri; }
+            set { discoveryUri = value; }
+        }
+
 		public bool IsStarted
 		{
 			get { return isStarted; }
@@ -290,9 +314,11 @@
 		{
 			get { return group; }
 			set { group = value; }
-		}
+        }
+
+        #endregion
 
-		internal string MulticastType
+        internal string MulticastType
 		{
 			get { return group + "." + TYPE_SUFFIX; }
 		}

Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/vs2008-activemq-test.csproj
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jun 11 21:56:48 2009
@@ -0,0 +1 @@
+/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/vs2008-activemq-test.csproj:783798

Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/vs2008-activemq.csproj
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jun 11 21:56:48 2009
@@ -0,0 +1 @@
+/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/vs2008-activemq.csproj:783798

Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/vs2008-activemq.sln
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jun 11 21:56:48 2009
@@ -0,0 +1 @@
+/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/vs2008-activemq.sln:783798