[Spread-cvs] commit: r450 - in trunk: daemon java/spread

jonathan at spread.org jonathan at spread.org
Sun Jan 8 22:02:59 EST 2012


Author: jonathan
Date: 2012-01-08 22:02:59 -0500 (Sun, 08 Jan 2012)
New Revision: 450

Modified:
   trunk/daemon/Changelog
   trunk/java/spread/SpreadConnection.java
Log:
Bugfix for Java client library to allow a SpreadConnection to be reconnected after calling disconnect even if an exception occurred. Fix by Renee Mathur.

Modified: trunk/daemon/Changelog
===================================================================
--- trunk/daemon/Changelog	2012-01-07 03:39:20 UTC (rev 449)
+++ trunk/daemon/Changelog	2012-01-09 03:02:59 UTC (rev 450)
@@ -1,3 +1,11 @@
+Sun Jan  8 21:55:37 2012  Jonathan Stanton  <jonathan at spreadconcepts.com>
+
+	* SpreadConnection.java (disconnect): Fix bug where calling 
+	disconnect() on a java SpreadConnection did not set connected to false
+	if an exception occurred. This would prevent reconnection of the client.
+	Fix and bug report from Renee Mathur. 
+
+
 Fri Jan  6 22:37:59 2012  Jonathan Stanton  <jonathan at spreadconcepts.com>
 
 	* SpreadMessage.java: Fix crash when add an array of groups to addGroups.

Modified: trunk/java/spread/SpreadConnection.java
===================================================================
--- trunk/java/spread/SpreadConnection.java	2012-01-07 03:39:20 UTC (rev 449)
+++ trunk/java/spread/SpreadConnection.java	2012-01-09 03:02:59 UTC (rev 450)
@@ -942,44 +942,46 @@
 			//////////////////////////////////
 			return;
 		}
+		try {
+		    // Get a new message.
+		    /////////////////////
+		    SpreadMessage killMessage = new SpreadMessage();
 		
-		// Get a new message.
-		/////////////////////
-		SpreadMessage killMessage = new SpreadMessage();
+		    // Send it to our private group.
+		    ////////////////////////////////
+		    killMessage.addGroup(group);
 		
-		// Send it to our private group.
-		////////////////////////////////
-		killMessage.addGroup(group);
+		    // Set the service type.
+		    ////////////////////////
+		    killMessage.setServiceType(SpreadMessage.KILL_MESS);
 		
-		// Set the service type.
-		////////////////////////
-		killMessage.setServiceType(SpreadMessage.KILL_MESS);
+		    // Send the message.
+		    ////////////////////
+		    multicast(killMessage);
 		
-		// Send the message.
-		////////////////////
-		multicast(killMessage);
-		
-		// Check for a listener thread.
-		///////////////////////////////
-		if(listener != null)
-		{
+		    // Check for a listener thread.
+		    ///////////////////////////////
+		    if(listener != null)
+		    {
 			// Stop it.
 			///////////
 			stopListener();
-		}
+		    }
 		
-		// Close the socket.
-		////////////////////
-		try
-		{
+		    // Close the socket.
+		    ////////////////////
+		    try
+		    {
 			socket.close();
-		}
-		catch(IOException e)
-		{
+		    }
+		    catch(IOException e)
+		    {
 			throw new SpreadException("close(): " + e);
+		    }
+		} 
+		finally {
+		    connected = false;
 		}
-
-		connected = false;
 	}
 	
 	// Gets the user's private group.




More information about the Spread-cvs mailing list