diff --git a/CMakeLists.txt b/CMakeLists.txt index a83bf87..f16bf1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project (expandurl-mastodon - VERSION 0.6.4 + VERSION 0.6.5 LANGUAGES CXX ) diff --git a/src/masto.cpp b/src/masto.cpp index 2fab7ac..805d555 100644 --- a/src/masto.cpp +++ b/src/masto.cpp @@ -110,12 +110,19 @@ const void Listener::start() { _thread = std::thread([=] { + std::uint_fast16_t ret = 0; _running = true; Easy masto(_instance, _access_token); masto.set_useragent(static_cast("expandurl-mastodon/") + global::version); - masto.get_stream(Mastodon::API::v1::streaming_user, _stream, _ptr); + ret = masto.get_stream(Mastodon::API::v1::streaming_user, _stream, _ptr); syslog(LOG_DEBUG, "Connection lost."); + if (ret != 0 && ret != 14) // 14 means canceled by user + { + syslog(LOG_ERR, "Connection terminated: Error %u", ret); + syslog(LOG_INFO, "Waiting for 30 seconds"); + std::this_thread::sleep_for(std::chrono::seconds(30)); + } _running = false; }); while (_ptr == nullptr)