aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2017-03-13 15:52:54 +0100
committerMarvin W <git@larma.de>2017-03-13 15:52:54 +0100
commit0087a7135e1feda12669918b4646ed1ad463d415 (patch)
tree8d493dc62b2e2bdea795d01a461108b4c06493bb
parent2804799f61eb4c68c5cf88b9996d13a81fe6317d (diff)
downloaddino-0087a7135e1feda12669918b4646ed1ad463d415.tar.gz
dino-0087a7135e1feda12669918b4646ed1ad463d415.zip
Fix account repeated disconnect/connect issues
-rw-r--r--libdino/src/service/connection_manager.vala11
1 files changed, 7 insertions, 4 deletions
diff --git a/libdino/src/service/connection_manager.vala b/libdino/src/service/connection_manager.vala
index c95e42e3..263bc815 100644
--- a/libdino/src/service/connection_manager.vala
+++ b/libdino/src/service/connection_manager.vala
@@ -74,12 +74,12 @@ public class ConnectionManager {
public void disconnect(Account account) {
change_connection_state(account, ConnectionState.DISCONNECTED);
+ connection_todo.remove(account);
if (stream_states.has_key(account)) {
try {
stream_states[account].stream.disconnect();
} catch (Error e) { }
}
- connection_todo.remove(account);
}
private Core.XmppStream? connect_(Account account, string? resource = null) {
@@ -106,8 +106,12 @@ public class ConnectionManager {
} catch (Error e) {
stderr.printf("Stream Error: %s\n", e.message);
change_connection_state(account, ConnectionState.DISCONNECTED);
- interpret_reconnect_flags(account, StreamError.Flag.get_flag(stream) ??
- new StreamError.Flag() { reconnection_recomendation = StreamError.Flag.Reconnect.NOW });
+ if (!connection_todo.contains(account)) {
+ stream_states.unset(account);
+ } else {
+ interpret_reconnect_flags(account, StreamError.Flag.get_flag(stream) ??
+ new StreamError.Flag() { reconnection_recomendation = StreamError.Flag.Reconnect.NOW });
+ }
}
return null;
});
@@ -117,7 +121,6 @@ public class ConnectionManager {
}
private void interpret_reconnect_flags(Account account, StreamError.Flag stream_error_flag) {
- if (!connection_todo.contains(account)) return;
int wait_sec = 10;
if (network_manager != null && network_manager.State != NetworkManager.CONNECTED_GLOBAL) {
wait_sec = 60;