dccex: fix: crash caused by failing tcp connect

caused by unhandled exception
see #120
Dieser Commit ist enthalten in:
Reinder Feenstra 2024-04-29 23:34:25 +02:00
Ursprung 5f3bf103b3
Commit acfc28bc89
2 geänderte Dateien mit 19 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -282,7 +282,10 @@ bool DCCEXInterface::setOnline(bool& value, bool simulation)
m_kernel->stop();
m_kernel.reset();
setState(InterfaceState::Offline);
if(status->state != InterfaceState::Error)
{
setState(InterfaceState::Offline);
}
}
return true;
}

Datei anzeigen

@ -32,6 +32,7 @@
#include "../../../utils/rtrim.hpp"
#include "../../../core/eventloop.hpp"
#include "../../../log/log.hpp"
#include "../../../log/logmessageexception.hpp"
#include "../../../utils/inrange.hpp"
#include "../../../utils/fromchars.hpp"
#include "../../../utils/displayname.hpp"
@ -82,7 +83,20 @@ void Kernel::start()
m_ioContext.post(
[this]()
{
m_ioHandler->start();
try
{
m_ioHandler->start();
}
catch(const LogMessageException& e)
{
EventLoop::call(
[this, e]()
{
Log::log(logId, e.message(), e.args());
error();
});
return;
}
m_startupDelayTimer.expires_after(boost::asio::chrono::milliseconds(m_config.startupDelay));
m_startupDelayTimer.async_wait(std::bind(&Kernel::startupDelayExpired, this, std::placeholders::_1));