From 55ff032856b22aa5e91a3416b83f69f577f732d3 Mon Sep 17 00:00:00 2001 From: yvesf Date: Thu, 2 Jul 2009 20:07:56 +0000 Subject: yhia git-svn-id: http://xapek.org/svn/common/omegle@1174 d0e8fea9-7529-0410-93fb-d39fd5b9c1dd --- omegle.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'omegle.py') diff --git a/omegle.py b/omegle.py index 62a3892..2a8eae2 100644 --- a/omegle.py +++ b/omegle.py @@ -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) -- cgit v1.2.1