well, we've been having some interesting disconnect bugs in the test
conference application we're developing. The problem was actually,
when 2 clients are connected, one (say A) disconnects and reconnects,
publishes stream with a different name, the other one (say B)
subscribes to it, and then B is disconnected from server. Server-log
seems like its normal, the client closed connection. Client
NetConnection.onStatus() gets a Connection.Closed. But i couldn't find
it.

I've managed to regenerate a similar bug, i'm not sure if this is the
same, i don't think we have a "subscribe to own stream" in the client,
but we may have :)

i've been trying to regenerate this behaviour for the last 6 hours,
and i think i've managed to do so. Just, a client connects, starting
publishing his cam with a name, and then he creates a second NetStream
object and subscribes to his own stream.

The server sometimes disconnects the client directly, and sometimes
not, i'd say %50 of the time. Just connect&disconnect a few times if
it doesn't on the first try. (sometimes it does on the first try, so
i'm sure it's not about some garbage from old connection)

I'm not sure if this is the cause of the problem in our test
client/application, i don't think it subscribes to its own stream (but
i'll check it), the actual problem may be somewhere else, but this
code below seems to regenerate the problem.

here's the actionscript, just add the 3 items on stage and there you go

---------------
// 3 elements needed on stage
// ConnectButton -- a button
// video         -- a video object
// Text          -- a textarea object


nc = new NetConnection();

var ns1 = null;
var ns2 = null;

ConnectButton.text = "Connect";

nc.onStatus = function (info)
{
        Text.text += info.code + "\n";
        ConnectButton.enabled = true;

        switch(info.code)
        {
                case "NetConnection.Connect.Success":
                        ConnectButton.label = "Disconnect";
                        
                        ns1 = new NetStream(nc);
                        ns1.attachVideo(Camera.get());
                        ns1.publish("hede", "live");
                        
                        ns2 = new NetStream(nc);
                        video.attachVideo(ns2);
                        ns2.play("hede");
                        
                        break;
                case "NetConnection.Connect.Failed":
                        ConnectButton.label = "Connect";
                        break;
                case "NetConnection.Connect.Closed":
                        ConnectButton.label = "Connect";
                        
                        if (ns1 != null)
                        {
                                ns1.close();
                                ns1 = null;
                        }
                        if (ns2 != null)
                        {
                                ns2.close();
                                ns2 = null;
                                video.clear();
                        }

                        break;
        }
}

ConnectButton.addEventListener("click", this);

function click (ev)
{
        var button = ev.target;
        if (button == ConnectButton)
        {
                switch (button.label)
                {
                case "Connect":
                        nc.connect("rtmp://localhost/test");
                        button.label = "Wait...";
                        button.enabled = false;
                        break;
                case "Disconnect":
                        nc.close();
                        button.label = "Connect";
                        break;
                }
        }
}
-----------------

-kerem

_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to