[jadmin] pyYIMt disconnects after 5 minutes

oliver bril oliver_bril at hotmail.com
Tue Nov 6 05:57:09 CST 2007


Norman,
 
This does the trick i think, the connection stays up. This is what i have:
 
yahoo.py (stays default):
 
        freq = 5 * 60 #overide to ping time to try and reduce disconnects        offset = int(time.time())%freq        yobj.pripingtime = time.time()        yobj.pripingobj=(freq,offset,self.yahooqueue,[yobj.fromjid, yobj.ymsg_send_priping()])        timerlist.append(yobj.pripingobj)        freq = yobj.secpingtime*60
 
 
ylib.py (changed)
 
     def ymsg_send_priping(self):        if 1 or time.time() - self.pripingtime > 10:            pay = ymsg_mkargu({109:self.username})            hdr = ymsg_mkhdr(self.version,len(pay),Y_ping,1,self.session)            self.pripingtime = time.time()            return hdr+pay
 
    def ymsg_send_secping(self):        if 1 or time.time() - self.secpingtime > 10:            pay = ''            hdr = ymsg_mkhdr(self.version,len(pay),Y_ping2, 1, self.session)            self.secpingtime = time.time()            return hdr+pay
  
  def ymsg_send_confping(self):        if 1 or time.time() - self.confpingtime > 10:            pay = ''            hdr = ymsg_mkhdr(self.version,len(pay),Y_ping2, 1, self.session)            self.confpingtime = time.time()            return hdr+pay
 
ok, i see the pings going towards yahoo every 5 minutes, so perhaps i should change the first "freq" parameter to 4*60.Another question: is it normal to have 308 the same lines in debug when a ping gets send?
 
The debug line looks like this:
 
send ('YMSG', 786432, 18, 161, 1, -1047506570) {0: {109: '<yahoo user>'}} 38
 
Kind regards,
Oliver.







 



> Date: Tue, 6 Nov 2007 13:02:01 +0200> From: norman at rasmussen.co.za> To: jadmin at jabber.org> Subject: Re: [jadmin] pyYIMt disconnects after 5 minutes> > 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/> _______________________________________________> JAdmin mailing list> JAdmin at jabber.org> http://mail.jabber.org/mailman/listinfo/jadmin> FAQ: http://www.jabber.org/about/jadminfaq.shtml> _______________________________________________
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.jabber.org/pipermail/jadmin/attachments/20071106/bab23ef6/attachment-0001.htm 


More information about the JAdmin mailing list