diff options
author | eionrobb <eionrobb@8ca6c67d-4297-256d-f884-781da6d5760b> | 2013-07-07 13:48:08 +0400 |
---|---|---|
committer | eionrobb <eionrobb@8ca6c67d-4297-256d-f884-781da6d5760b> | 2013-07-07 13:48:08 +0400 |
commit | 2c365de359f9b0f56eabe01baaa9b08a90ae24b7 (patch) | |
tree | 1b70e7aa88832b6e6450f508b9a266c89aa889ac | |
parent | 4eb6c37e9d747c9c1473c1712dc090fdd24fdc25 (diff) |
Add in a watchdog to make sure that if our polling loop doesn't get a server response in 3 minutes, that it tries to re-poll
-rw-r--r-- | steam-mobile/libsteam.c | 6 | ||||
-rw-r--r-- | steam-mobile/libsteam.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/steam-mobile/libsteam.c b/steam-mobile/libsteam.c index ed83153..6834f60 100644 --- a/steam-mobile/libsteam.c +++ b/steam-mobile/libsteam.c @@ -234,6 +234,11 @@ gboolean steam_timeout(gpointer userdata) {
SteamAccount *sa = userdata;
steam_poll(sa, FALSE, sa->message);
+
+ // If no response within 3 minutes, assume connection lost and try again
+ purple_timeout_remove(sa->watchdog_timeout);
+ sa->watchdog_timeout = purple_timeout_add_seconds(3 * 60, steam_timeout, sa);
+
return FALSE;
}
@@ -1022,6 +1027,7 @@ static void steam_close(PurpleConnection *pc) g_string_free(post, TRUE);
purple_timeout_remove(sa->poll_timeout);
+ purple_timeout_remove(sa->watchdog_timeout);
purple_debug_info("steam", "destroying %d waiting connections\n",
g_queue_get_length(sa->waiting_conns));
diff --git a/steam-mobile/libsteam.h b/steam-mobile/libsteam.h index 17cb0db..018c3de 100644 --- a/steam-mobile/libsteam.h +++ b/steam-mobile/libsteam.h @@ -88,6 +88,8 @@ struct _SteamAccount { gint idletime; guint last_message_timestamp; gchar *cached_access_token; + + guint watchdog_timeout; }; struct _SteamBuddy { |