fixed reconnect code
This commit is contained in:
parent
4d48e5fa1c
commit
08a7cb1988
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required (VERSION 3.7)
|
||||
project (expandurl-mastodon
|
||||
VERSION 0.2.5
|
||||
VERSION 0.2.6
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ int main(int argc, char *argv[])
|
|||
if (!listener.stillrunning())
|
||||
{
|
||||
cout << "DEBUG: Reestablishing connection...\n";
|
||||
listener.stop();
|
||||
listener.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -97,6 +97,7 @@ std::vector<Easy::Notification> Listener::get_new_messages()
|
|||
v.push_back(Easy::Notification(event.second));
|
||||
}
|
||||
}
|
||||
count_empty = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -104,8 +105,9 @@ std::vector<Easy::Notification> Listener::get_new_messages()
|
|||
++count_empty;
|
||||
if (count_empty > 5)
|
||||
{
|
||||
_running = false;
|
||||
count_empty = 0;
|
||||
cout << "DEBUG: Detected broken connection.\n";
|
||||
_running = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue