robertdoo / red5

Automatically exported from code.google.com/p/red5
0 stars 0 forks source link

streamBroadcastClose getLocalConnection contains wrong connection #485

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. two users stream to one MultiThreadedApplication
2. user1 :
            -> streaming to '/live/123' streamname user1
            -> playing stream user2
   user2 :
            -> streaming to '/live/123' streamname user2
            //-> playing stream user1 
3. hard disconnect user2 (kill internet connection / close browser / ...)

What is the expected output? What do you see instead?

Red5.getLocalConnection in public void streamBroadcastClose(IBroadcastStream 
stream) from MultiThreadedApplication should contain the connection from user2

Instead it contains the connection from user1

Maybe the issue originates here: it's changed from user2 to user1 in 
 src/main/java/org/red5/server/net/rtmp/codec/RTMPMinaProtocolEncoder.java
            if (!conn.equals((RTMPConnection) Red5.getConnectionLocal())) {
                log.debug("Connection local ({}) didn't match io session ({})", (Red5.getConnectionLocal() != null ? Red5.getConnectionLocal().getSessionId() : "null"), sessionId);

(to send the streamBroadcastClose message to user1)

What version of the product are you using? On what operating system?

revision 4758, 
Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.35-2 x86_64 GNU/Linux

Please provide any additional information below.

Original issue reported on code.google.com by petervan...@gmail.com on 11 Feb 2014 at 3:54

GoogleCodeExporter commented 9 years ago
That bit of code ensures that an IoSession marked with a particular client 
connection does not get mixed up with another IoSession that doesn't relate. I 
think the confusion here is that the server is trying to notify user1 that 
user2's stream has closed.

Original comment by mondain on 26 Feb 2014 at 12:26

GoogleCodeExporter commented 9 years ago
Yes indeed. 
But after notifying user1 that user2's stream has closed, when red5 reaches 
streamBroadcastClose(IBroadcastStream stream) the function 
Red5.getConnectionLocal() should return the connection from user2 (i.e. the 
connection from the stream that closes)? 

Now it returns the wrong connection from user1.

Original comment by petervan...@gmail.com on 26 Feb 2014 at 9:54

GoogleCodeExporter commented 9 years ago
Would you mind testing this with a newer build? Specifically 1.0.2-M3 or newer.

Original comment by mondain on 4 Apr 2014 at 4:48

GoogleCodeExporter commented 9 years ago
Hi Mondain,

we tested with latest code from github and it is fixed

thank you!

Original comment by petervan...@gmail.com on 7 Apr 2014 at 10:07

GoogleCodeExporter commented 9 years ago

Original comment by mondain on 7 Apr 2014 at 1:36