aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service/connection_manager.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2018-09-16 13:54:47 +0200
committerfiaxh <git@mx.ax.lt>2018-09-16 14:04:36 +0200
commit9575b192e4d22d9f5422fae1b02ddf81db1ecf68 (patch)
tree8d311c2bd920b02d7cf2f1f45eb41dca5a1d7a14 /libdino/src/service/connection_manager.vala
parent6d947c42b5e573cb350a1354a47a3a806a22cbb2 (diff)
downloaddino-9575b192e4d22d9f5422fae1b02ddf81db1ecf68.tar.gz
dino-9575b192e4d22d9f5422fae1b02ddf81db1ecf68.zip
Fix runtime criticals
Diffstat (limited to 'libdino/src/service/connection_manager.vala')
-rw-r--r--libdino/src/service/connection_manager.vala22
1 files changed, 14 insertions, 8 deletions
diff --git a/libdino/src/service/connection_manager.vala b/libdino/src/service/connection_manager.vala
index b73cd117..2abbc9cb 100644
--- a/libdino/src/service/connection_manager.vala
+++ b/libdino/src/service/connection_manager.vala
@@ -121,7 +121,7 @@ public class ConnectionManager {
}
public void make_offline_all() {
- foreach (Account account in connection_todo) {
+ foreach (Account account in connections.keys) {
make_offline(account);
}
}
@@ -134,13 +134,17 @@ public class ConnectionManager {
}
public void disconnect(Account account) {
- make_offline(account);
- try {
- connections[account].stream.disconnect();
- } catch (Error e) { print(@"on_prepare_for_sleep error $(e.message)\n"); }
- connection_todo.remove(account);
if (connections.has_key(account)) {
- connections.unset(account);
+ make_offline(account);
+ try {
+ connections[account].stream.disconnect();
+ } catch (Error e) {
+ warning(@"Error disconnecting stream $(e.message)\n");
+ }
+ connection_todo.remove(account);
+ if (connections.has_key(account)) {
+ connections.unset(account);
+ }
}
}
@@ -283,7 +287,9 @@ public class ConnectionManager {
try {
make_offline(account);
connections[account].stream.disconnect();
- } catch (Error e) { print(@"on_prepare_for_sleep error $(e.message)\n"); }
+ } catch (Error e) {
+ warning(@"Error disconnecting stream $(e.message)\n");
+ }
}
} else {
print("Device un-suspend\n");