[Red5commits] [868] fixed application handlers not being called at all / in wrong order

jbauch luke at codegent.com
Tue Jun 20 04:06:18 EDT 2006


fixed application handlers not being called at all / in wrong order


Timestamp: 05/27/06 07:06:10 (3 weeks ago) 
Change: 868 
Author: jbauch

Files (see diff or trac for details): 
java/server/trunk/src/org/red5/server/Scope.java


Trac: http://mirror1.cvsdude.com/trac/osflash/red5/changeset/868

Index: /java/server/trunk/src/org/red5/server/Scope.java
===================================================================
--- /java/server/trunk/src/org/red5/server/Scope.java (revision 867)
+++ /java/server/trunk/src/org/red5/server/Scope.java (revision 868)
@@ -247,12 +247,12 @@
 	
 	public synchronized void disconnect(IConnection conn){
-		if(hasParent()) parent.disconnect(conn);
+		// We call the disconnect handlers in reverse order they were called
+		// during connection, i.e. roomDisconnect is called before appDisconnect.
 		final IClient client = conn.getClient();
 		if(clients.containsKey(client)){
 			final Set conns = clients.get(client);
 			conns.remove(conn);
-			removeEventListener(conn);
 			if(hasHandler()) {
-				handler.disconnect(conn, this);
+				getHandler().disconnect(conn, this);
 			}
 			if(conns.isEmpty()) {
@@ -260,8 +260,10 @@
 				if(hasHandler()){
 					// there may be a timeout here ?
-					handler.leave(client, this);
+					getHandler().leave(client, this);
 				}
 			}
-		}
+			removeEventListener(conn);
+		}
+		if(hasParent()) parent.disconnect(conn);
 	}
 


Note:
Diffs are chopped if more than 30k.
This is to get past the limit on the mailing list.



More information about the Red5commits mailing list