diff options
Diffstat (limited to 'omegle.py')
-rw-r--r-- | omegle.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -34,6 +34,7 @@ class Timer(Thread): self.logger.debug("self.running == False") def stop(self): + """ XXX break func() ? """ self.running = False self.event.set() @@ -65,9 +66,10 @@ class RESTClient(object): class OmegleChat(RESTClient): def __init__(self,poll_interval=0.5,name="",host="omegle.com"): self.name = name + self.poll_interval=poll_interval RESTClient.__init__(self,host) - self.timer = Timer(self._events, poll_interval) + self.timer = Timer(self._events, poll_interval) self.logger = logging.getLogger(__name__ + "." + self.__class__.__name__ + name) self.is_confirmed = False #after getting a connection confirm self.is_connected = False #after having self.id @@ -86,8 +88,9 @@ class OmegleChat(RESTClient): self.id = id[1] self.logger.info("Connected id=%s" % self.id) #start /events polling - self.timer.start() self.is_connected = True + self.timer = Timer(self._events, self.poll_interval) + self.timer.start() else: self.logger.error("Bad response: %s" % body) raise Exception("Bad response: %s" % body) |