fixed reconnect code
This commit is contained in:
parent
4d48e5fa1c
commit
08a7cb1988
|
@ -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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue