]> iEval git - fonbot.git/blobdiff - src/ro/ieval/fonbot/FonBotMainService.java
Make FonBot usable
[fonbot.git] / src / ro / ieval / fonbot / FonBotMainService.java
index 8e8d67a0c535806b89f0e37a6eed6d46503dfe47..dd13affe715aef6f403d1fba71fc6c87e00bf8ac 100644 (file)
@@ -3,6 +3,7 @@ package ro.ieval.fonbot;
 import static ro.ieval.fonbot.R.string.*;
 import static ro.ieval.fonbot.Utils.toNonNull;
 
+import java.net.SocketTimeoutException;
 import java.util.Collections;
 import java.util.EnumSet;
 import java.util.Set;
@@ -77,7 +78,9 @@ public final class FonBotMainService extends Service {
                        Log.d("LongPollRunnable", "Long polling started");
                        while(man.getActiveNetworkInfo() != null && man.getActiveNetworkInfo().isConnected())
                                try {
-                                       runnable.run();
+                                       runnable.doRun();
+                               } catch (final SocketTimeoutException e){
+                                       Log.d("LongPollRunnable", "Socket timeout, refreshing connection");
                                } catch (final Exception ex){
                                        ex.printStackTrace();
                                        break;
@@ -178,6 +181,8 @@ public final class FonBotMainService extends Service {
                        longPollThread.start();
                }
 
+               ExecutableRunnable.retryTasks();
+
                final boolean runForeground=PreferenceManager.getDefaultSharedPreferences(this).getBoolean("foreground", false);
                if(!runForeground)
                        stopForeground(true);
This page took 0.023486 seconds and 4 git commands to generate.