Adam,
I changed your fix just a little and added it to trunk; my quick smoke-test
seemed to work fine. Thanks for the patch!

    public void ping() {
        long newPingTime = System.currentTimeMillis();
        if (lastPingSent == 0) {
            lastPongReceived = newPingTime;
        }
        Ping pingRequest = new Ping();
        pingRequest.setValue1((short) Ping.PING_CLIENT);
        lastPingSent = newPingTime;
        int now = (int) (lastPingSent & 0xffffffff);
        pingRequest.setValue2(now);
        pingRequest.setValue3(Ping.UNDEFINED);
        ping(pingRequest);
    }

Paul

On 8/24/07, Adam <[EMAIL PROTECTED]> wrote:
>
> So I found my app was taking a long time to index these
> files, which meant that it was timing out. No problem,
> thinks I, I'll just increase the timeout value in the
> red5.properties file.
>
> But it was to no avail! It coninued to timout, even when
> the rtmp.max_inactivity was set well high.
>
> Further investgation shows that RTMPConnection.java
> compares (lastPingSent - lastPongReceived > maxInactivity)
> to see if there's a timeout. Which is fine if it's
> ever recieved a ping reply, but if not even the first
> ping is replied to then lastPongReceived is still zero,
> so the comparison drops through to the code to close
> the inactive connection whatever the value of max_inactivity.
>
> This can be fixed with one line of code inserted into the
> ping() function to set lastPongReceived as well as lastPingSent
> if it's setting the value for the first time.
>
> One line does the trick:
>      if(lastPingSent==0){lastPongReceived = System.currentTimeMillis();}
>
>
>
> IE the pong function was:
> --------------
>         public void ping() {
>                 Ping pingRequest = new Ping();
>                 pingRequest.setValue1((short) Ping.PING_CLIENT);
>                 lastPingSent = System.currentTimeMillis();
>                 int now = (int) (lastPingSent & 0xffffffff);
>                 pingRequest.setValue2(now);
>                 pingRequest.setValue3(Ping.UNDEFINED);
>                 ping(pingRequest);
>         }
> --------------
>
> But a working version would read:
>
> --------------
>         public void ping() {
>                 if(lastPingSent==0){ lastPongReceived =
> System.currentTimeMillis(); }
>                 Ping pingRequest = new Ping();
>                 pingRequest.setValue1((short) Ping.PING_CLIENT);
>                 lastPingSent = System.currentTimeMillis();
>                 int now = (int) (lastPingSent & 0xffffffff);
>                 pingRequest.setValue2(now);
>                 pingRequest.setValue3(Ping.UNDEFINED);
>                 ping(pingRequest);
>         }
> --------------
>
>
> Can someone drop that into the main trunk? Or let me know
> where I should post the fix if this maillist isn't good enough?
>
> Thanks.
>
>         Adam..........
>
> _______________________________________________
> Red5 mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/red5_osflash.org
>



-- 
It is difficult to free fools from the chains they revere. - Voltaire
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to