[jadmin] pyYIMt disconnects after 5 minutes

Norman Rasmussen norman at rasmussen.co.za
Tue Nov 6 05:02:01 CST 2007


On Nov 6, 2007 11:41 AM, oliver bril <oliver_bril at hotmail.com> wrote:
> I really thought this should solve it but unfortunately it doesn't.

mmm, I think the timer code is more broken than I originally thought.
(Notes on this after the rest of the replies)

> When the user logs into the gateway I see a "got ping!" in de debug output.
cool, that's good, means yahoo hasn't changed anything.

> But no results. still receive a disconnect after 5 minutes. Does the ping
> itself show up in the debug output? this because i couldn't find any and i
> would expect to see at least one every 4,3 or 30 seconds (see above
> parameters)

the freq gives the time in seconds, so you were setting 1,3,4 minutes.
 There's also an internal minimum ping interval of 10 seconds.

> although I am really not familiar with python I also have changed the line:
> freq = yobj.secpingtime*60 into freq = yobj.secpingtime*30.
> Also no result.

That's the right code to change so no worries there.  You could also
have tried setting it to 5*60 to force it to 5 minutes - as an
example.

Here's the sad realisation part (and why I don't like maintaining
other people's code):

Having a look at the logic of the code, it seems that the code to
generate the ping check to see if it's generated a ping on the last 10
seconds (that minimum ping interval I was talking about).
It _also_ seems like the code to generate the ping is only called
_when the timer is set up_, instead of every time the timer is called!
 (don't ask it's been like this since day 1)
This means that the ping generation code has, um, never worked.

As the simplest 'hack' work around, to force it to always generate the
ping packets, edit ylib.py and around line 550, you should find three
copies of:

    if time.time() - self.pripingtime > 10:

if you change that to

    if 1 or time.time() - self.pripingtime > 10:

that should ensure that the packets are always generated.

BTW, if looks like the yahoo servers asks for a primary ping every 4
minutes (freq=4*60), and a secondary ping every hour (freq=60*60), so
you can force these alternatives, or just use the calculated defaults
for now.

-- 
- Norman Rasmussen
 - Email: norman at rasmussen.co.za
 - Home page: http://norman.rasmussen.co.za/


More information about the JAdmin mailing list