Skip to content

Commit

Permalink
SmackException while connecting in Listener null #29 - do two attemp…
Browse files Browse the repository at this point in the history
…ts to double the packet timeout
  • Loading branch information
yorrd committed Sep 21, 2014
1 parent 67578e8 commit f919f43
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/de/adornis/Notifier/Listener.java
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,23 @@ protected Void doInBackground(Void... params) {
try {
connect();
} catch (SmackException.NoResponseException e1) {
MainInterface.log("Couldn't log in with longer timeout either, giving up.");
e1.printStackTrace();
MainInterface.log("NoResponseException while connecting in Listener " + e.getMessage());
// probably got a timeout, try with bigger timeout
conn = new XMPPTCPConnection(MainInterface.getConfig(prefs.getAppUser().getDomain(), 5222));
MainInterface.log("Retrying with package timeout of " + conn.getPacketReplyTimeout() * 2 + " instead of " + conn.getPacketReplyTimeout());
conn.setPacketReplyTimeout(conn.getPacketReplyTimeout() * 2);
try {
connect();
} catch (SmackException.NoResponseException e2) {
MainInterface.log("Couldn't log in with longer timeout either, giving up.");
e2.printStackTrace();
} catch (Exception ignore) {
MainInterface.log("Some other error happened now o.0");
}
getApplicationContext().sendBroadcast(new Intent("LISTENER_CONNECTED"));
disconnect();
} catch (Exception ignore) {
MainInterface.log("Some other error happened now o.0");
MainInterface.log("Some other error hap SmackException while connecting in Listener null #29 pened now o.0");
}
getApplicationContext().sendBroadcast(new Intent("LISTENER_CONNECTED"));
disconnect();
Expand Down

0 comments on commit f919f43

Please sign in to comment.