diff options
author | fiaxh <git@lightrise.org> | 2018-12-30 13:35:01 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2019-01-02 15:59:56 +0100 |
commit | fc1a9a5712b1f46bcd2390e798147f3855042b96 (patch) | |
tree | bba4779f4fbaa57e26cdfb7a71c3078a6df3d056 /libdino | |
parent | cdd4c0b854fd4d27fa1d9bd941df03888301780a (diff) | |
download | dino-fc1a9a5712b1f46bcd2390e798147f3855042b96.tar.gz dino-fc1a9a5712b1f46bcd2390e798147f3855042b96.zip |
Improve ping timeouts, add debug output for XmlErrors and ping timeouts
Diffstat (limited to 'libdino')
-rw-r--r-- | libdino/src/service/connection_manager.vala | 6 | ||||
-rw-r--r-- | libdino/src/service/file_manager.vala | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/libdino/src/service/connection_manager.vala b/libdino/src/service/connection_manager.vala index 67763ad3..977fc732 100644 --- a/libdino/src/service/connection_manager.vala +++ b/libdino/src/service/connection_manager.vala @@ -232,6 +232,7 @@ public class ConnectionManager : Object { private void check_reconnect(Account account) { bool acked = false; + DateTime? last_activity_was = connections[account].last_activity != null ? connections[account].last_activity : null; XmppStream stream = connections[account].stream; stream.get_module(Xep.Ping.Module.IDENTITY).send_ping(stream, account.bare_jid.domain_jid, () => { @@ -240,10 +241,13 @@ public class ConnectionManager : Object { change_connection_state(account, ConnectionState.CONNECTED); }); - Timeout.add_seconds(5, () => { + Timeout.add_seconds(10, () => { if (connections[account].stream != stream) return false; if (acked) return false; + if (connections[account].last_activity != last_activity_was) return false; + // Reconnect. Nothing gets through the stream. + print(@"[$(account.bare_jid)] Ping timeouted. Reconnecting\n"); change_connection_state(account, ConnectionState.DISCONNECTED); try { connections[account].stream.disconnect(); diff --git a/libdino/src/service/file_manager.vala b/libdino/src/service/file_manager.vala index 861c51da..241bcebf 100644 --- a/libdino/src/service/file_manager.vala +++ b/libdino/src/service/file_manager.vala @@ -144,7 +144,7 @@ public class FileManager : StreamInteractionModule, Object { if (!is_sender_trustworthy(file_transfer, conversation)) return; if (file_transfer.size == -1) { - file_provider.get_meta_info(file_transfer); + yield file_provider.get_meta_info(file_transfer); } if (file_transfer.size >= 0 && file_transfer.size < 5000000) { |