Fix #245. Trying to keep serving after an exception in the handler.

This commit is contained in:
ipknHama 2017-09-17 12:44:15 +09:00
parent 2564c62778
commit 69a17f066b

View File

@ -121,13 +121,20 @@ namespace crow
timer.async_wait(handler);
init_count ++;
while(1)
{
try
{
io_service_pool_[i]->run();
if (io_service_pool_[i]->run() == 0)
{
// when io_service.run returns 0, there are no more works to do.
break;
}
} catch(std::exception& e)
{
CROW_LOG_ERROR << "Worker Crash: An uncaught exception occurred: " << e.what();
}
}
}));
if (tick_function_ && tick_interval_.count() > 0)