OSDN Git Service

Fixed an event ordering issue. The server now only
authorPSpeed42@gmail.com <PSpeed42@gmail.com@75d07b2b-3a1a-0410-a2c5-0572b91ccdca>
Tue, 12 Jul 2011 20:07:11 +0000 (20:07 +0000)
committerPSpeed42@gmail.com <PSpeed42@gmail.com@75d07b2b-3a1a-0410-a2c5-0572b91ccdca>
Tue, 12 Jul 2011 20:07:11 +0000 (20:07 +0000)
first the connection added event after sending the
connect confirmation to the client.  This prevents
a resource deadlock if the connection listener
tries to send a message to the client and the
client tries to send a response back... since the
client won't have been fully initialized yet.

git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@7854 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

engine/src/networking/com/jme3/network/base/DefaultServer.java

index 2353346..a669ff3 100644 (file)
@@ -312,16 +312,16 @@ public class DefaultServer implements Server
         if( addedConnection != null ) {       
             log.log( Level.INFO, "Client registered:{0}.", addedConnection );
             
-            // Now we can notify the listeners about the
-            // new connection.
-            fireConnectionAdded( addedConnection );
-                                                    
             // Send the ID back to the client letting it know it's
             // fully connected.
             m = new ClientRegistrationMessage();
             m.setId( addedConnection.getId() );
             m.setReliable(true);
             addedConnection.send(m);
+            
+            // Now we can notify the listeners about the
+            // new connection.
+            fireConnectionAdded( addedConnection );                                                   
         }            
     }