- if len(self.events) > 0: timeout = 0
- while True:
- (r, _, _) = select([self.rfh], [], [], timeout)
+
+ # Never have no timeout...
+ if timeout == None: timeout = 60*60*24*365
+
+ # Make sure we go through the loop at least once.
+ if timeout < 0: timeout = 0
+
+ while timeout >= 0:
+ this_timeout = min(timeout, 0.2)
+ timeout -= this_timeout
+
+ (r, _, _) = select([self.rfh], [], [], this_timeout)