fixed reconnect code

This commit is contained in:
tastytea 2018-05-17 13:57:21 +02:00
parent 4d48e5fa1c
commit 08a7cb1988
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
3 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.7) cmake_minimum_required (VERSION 3.7)
project (expandurl-mastodon project (expandurl-mastodon
VERSION 0.2.5 VERSION 0.2.6
LANGUAGES CXX LANGUAGES CXX
) )

View File

@ -62,6 +62,7 @@ int main(int argc, char *argv[])
if (!listener.stillrunning()) if (!listener.stillrunning())
{ {
cout << "DEBUG: Reestablishing connection...\n"; cout << "DEBUG: Reestablishing connection...\n";
listener.stop();
listener.start(); listener.start();
} }

View File

@ -97,6 +97,7 @@ std::vector<Easy::Notification> Listener::get_new_messages()
v.push_back(Easy::Notification(event.second)); v.push_back(Easy::Notification(event.second));
} }
} }
count_empty = 0;
} }
else else
{ {
@ -104,8 +105,9 @@ std::vector<Easy::Notification> Listener::get_new_messages()
++count_empty; ++count_empty;
if (count_empty > 5) if (count_empty > 5)
{ {
_running = false;
count_empty = 0; count_empty = 0;
cout << "DEBUG: Detected broken connection.\n";
_running = false;
} }
} }