From 4d533f1389645dab9e91f94ce541205f2749c292 Mon Sep 17 00:00:00 2001 From: Riccardo (C10uD) Date: Mon, 26 Jul 2010 23:42:48 +0200 Subject: [PATCH] Convert some gobject timeout_add to timeout_add_seconds. See http://live.gnome.org/GnomeGoals/UseTimeoutAddSeconds --- papyon/sip/call.py | 4 ++-- papyon/sip/transport.py | 2 +- papyon/sip/turn.py | 4 ++-- papyon/transport.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/papyon/sip/call.py b/papyon/sip/call.py index c409b0b..f5e197b 100644 --- a/papyon/sip/call.py +++ b/papyon/sip/call.py @@ -181,7 +181,7 @@ class SIPBaseCall(gobject.GObject): def start_timeout(self, name, time): self.stop_timeout(name) - source = gobject.timeout_add(time * 1000, self.on_timeout, name) + source = gobject.timeout_add_seconds(time, self.on_timeout, name) self._timeout_sources[name] = source def stop_timeout(self, name): @@ -615,7 +615,7 @@ class SIPRegistration(SIPBaseCall): self._state = "REGISTERED" self.emit("registered") timeout = int(response.get_header("Expires", 30)) - self._src = gobject.timeout_add(timeout * 1000, self.on_expire) + self._src = gobject.timeout_add_seconds(timeout, self.on_expire) if self._pending_unregister: self.unregister() else: diff --git a/papyon/sip/transport.py b/papyon/sip/transport.py index baf171f..ab02225 100644 --- a/papyon/sip/transport.py +++ b/papyon/sip/transport.py @@ -100,7 +100,7 @@ class SIPTransport(SIPBaseTransport): self._client.send(data) def _start_keep_alive(self): - self._alive_src = gobject.timeout_add(5000, self._on_keep_alive) + self._alive_src = gobject.timeout_add_seconds(5, self._on_keep_alive) def _stop_keep_alive(self): if self._alive_src is not None: diff --git a/papyon/sip/turn.py b/papyon/sip/turn.py index 9d5f4d3..956671c 100644 --- a/papyon/sip/turn.py +++ b/papyon/sip/turn.py @@ -79,7 +79,7 @@ class AttributeTypes(object): ALTERNATE_SERVER = 32803 REFRESH_INTERVAL = 32804 -REQUEST_TIMEOUT = 5000 # milliseconds +REQUEST_TIMEOUT = 5 # seconds class TURNClient(gobject.GObject): @@ -120,7 +120,7 @@ class TURNClient(gobject.GObject): @RequireSecurityTokens(LiveService.MESSENGER_SECURE) def request_shared_secret(self, callback, errcb, count=4): - self._src = gobject.timeout_add(REQUEST_TIMEOUT, self.on_timeout) + self._src = gobject.timeout_add_seconds(REQUEST_TIMEOUT, self.on_timeout) for _ in range(count): token = self._tokens[LiveService.MESSENGER_SECURE] username = "RPS_%s\x00\x00\x00" % token diff --git a/papyon/transport.py b/papyon/transport.py index 77cb35a..b3fd033 100644 --- a/papyon/transport.py +++ b/papyon/transport.py @@ -292,7 +292,7 @@ class DirectConnection(BaseTransport): def __handle_ping_reply(self, command): timeout = int(command.arguments[0]) - self.__png_timeout = gobject.timeout_add(timeout * 1000, self.enable_ping) + self.__png_timeout = gobject.timeout_add_seconds(timeout, self.enable_ping) ### callbacks def __on_status_change(self, transport, param): @@ -371,7 +371,7 @@ class HTTPPollConnection(BaseTransport): def establish_connection(self): logger.debug('<-> Connecting to %s:%d' % self.server) - self._polling_source_id = gobject.timeout_add(5000, self._poll) + self._polling_source_id = gobject.timeout_add_seconds(5, self._poll) self.emit("connection-success") def lose_connection(self): -- 1.7.0.4