From 08a7cb1988172d420dc331d59b055a63cae27c49 Mon Sep 17 00:00:00 2001 From: tastytea Date: Thu, 17 May 2018 13:57:21 +0200 Subject: [PATCH] fixed reconnect code --- CMakeLists.txt | 2 +- src/main.cpp | 1 + src/masto.cpp | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24bb7a3..79a836f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project (expandurl-mastodon - VERSION 0.2.5 + VERSION 0.2.6 LANGUAGES CXX ) diff --git a/src/main.cpp b/src/main.cpp index 5cb1cab..efd2791 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -62,6 +62,7 @@ int main(int argc, char *argv[]) if (!listener.stillrunning()) { cout << "DEBUG: Reestablishing connection...\n"; + listener.stop(); listener.start(); } diff --git a/src/masto.cpp b/src/masto.cpp index e0aea67..84df9c6 100644 --- a/src/masto.cpp +++ b/src/masto.cpp @@ -97,6 +97,7 @@ std::vector Listener::get_new_messages() v.push_back(Easy::Notification(event.second)); } } + count_empty = 0; } else { @@ -104,8 +105,9 @@ std::vector Listener::get_new_messages() ++count_empty; if (count_empty > 5) { - _running = false; count_empty = 0; + cout << "DEBUG: Detected broken connection.\n"; + _running = false; } }