Re: Adding idle timeout capabilities to asyncore

2007-10-25 Thread Jean-Paul Calderone
On Thu, 25 Oct 2007 04:46:12 -, Josiah Carlson <[EMAIL PROTECTED]> wrote: > [snip] >But really, since I already wrote code that handles *all* of >the timeout handling with a *single* time.time() call, and that also >generally minimizes all explicit function calls, I'm not sure that >your testin

Re: Adding idle timeout capabilities to asyncore

2007-10-24 Thread Paul Rubin
Giampaolo Rodola' <[EMAIL PROTECTED]> writes: > def readable(self): > if time.time() >= self.timeout: > self.send("Timeout") > self.close() > return 1 Don't do it this way. Put all the timeouts into a priority queue (see the heapq module) so you only need to check the one

Re: Adding idle timeout capabilities to asyncore

2007-10-24 Thread Josiah Carlson
On Oct 23, 9:30 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Tue, 23 Oct 2007 15:34:19 -, Josiah Carlson <[EMAIL PROTECTED]> wrote: > > [snip] > > >Calling time.time() is relatively inexpensive in comparison to pure > >Python function calls, but indeed, it could be a bottleneck. > >

Re: Adding idle timeout capabilities to asyncore

2007-10-24 Thread Giampaolo Rodola'
On 23 Ott, 17:34, Josiah Carlson <[EMAIL PROTECTED]> wrote: > On 22 Ott, 12:28, Giampaolo Rodola' <[EMAIL PROTECTED]> wrote: > > > > > > > Hi there. > > We're talking about an asyncore-based server. > > Just for the heck of it I'd like to set a timeout which will > > disconnects the clients if they

Re: Adding idle timeout capabilities to asyncore

2007-10-23 Thread Jean-Paul Calderone
On Tue, 23 Oct 2007 15:34:19 -, Josiah Carlson <[EMAIL PROTECTED]> wrote: > [snip] > >Calling time.time() is relatively inexpensive in comparison to pure >Python function calls, but indeed, it could be a bottleneck. Did you benchmark this on some system? There isn't really any "pure Python fu

Re: Adding idle timeout capabilities to asyncore

2007-10-23 Thread Josiah Carlson
On 22 Ott, 12:28, Giampaolo Rodola' <[EMAIL PROTECTED]> wrote: > Hi there. > We're talking about an asyncore-based server. > Just for the heck of it I'd like to set a timeout which will > disconnects the clients if they're inactive (i.e., no command or data > transfer in progress) for a long period

Adding idle timeout capabilities to asyncore

2007-10-22 Thread Giampaolo Rodola'
Hi there. We're talking about an asyncore-based server. Just for the heck of it I'd like to set a timeout which will disconnects the clients if they're inactive (i.e., no command or data transfer in progress) for a long period of time. I was thinking about putting the timeout value into an attribut