0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 07:23:53 +01:00

ircd: Remove / update various ctx::interrupted catch blocks for ctx::terminated.

This commit is contained in:
Jason Volk 2018-05-06 01:15:26 -07:00
parent 48055cb276
commit 003ecf6357
10 changed files with 29 additions and 87 deletions

View file

@ -261,6 +261,11 @@ catch(const ctx::interrupted &e)
cancel(); cancel();
throw; throw;
} }
catch(const ctx::terminated &)
{
cancel();
throw;
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //

View file

@ -783,10 +783,6 @@ try
return ret; return ret;
} }
catch(const ctx::interrupted &e)
{
throw;
}
catch(const boost::system::system_error &e) catch(const boost::system::system_error &e)
{ {
if(e.code().value() != boost::system::errc::operation_canceled) if(e.code().value() != boost::system::errc::operation_canceled)

View file

@ -70,12 +70,19 @@ noexcept try
if(likely(bool(func))) if(likely(bool(func)))
func(); func();
} }
catch(const ircd::ctx::interrupted &)
{
return;
}
catch(const ircd::ctx::terminated &)
{
return;
}
catch(const std::exception &e) catch(const std::exception &e)
{ {
log::critical log::critical
{ {
"ctx(%p '%s' #%u): unhandled: %s", "ctx('%s' #%u): unhandled: %s",
current,
name, name,
id, id,
e.what() e.what()
@ -88,10 +95,6 @@ catch(const std::exception &e)
// handling the exception here with a log message and calling it a day. // handling the exception here with a log message and calling it a day.
return; return;
} }
catch(const terminated &)
{
return;
}
/// Direct context switch to this context. /// Direct context switch to this context.
/// ///
@ -913,12 +916,17 @@ noexcept try
} }
catch(const interrupted &e) catch(const interrupted &e)
{ {
/* // log::debug
log::debug // {
{ // "pool(%p) ctx(%p): %s", this, &cur(), e.what()
"pool(%p) ctx(%p): %s", this, &cur(), e.what() // };
}; }
*/ catch(const terminated &e)
{
// log::debug
// {
// "pool(%p) ctx(%p): %s", this, &cur(), e.what()
// };
} }
void void

View file

@ -235,11 +235,11 @@ noexcept try
// executes backwards from this point and shuts down IRCd. // executes backwards from this point and shuts down IRCd.
ctx::wait(); ctx::wait();
} }
catch(const ctx::interrupted &e) catch(const ctx::terminated &)
{ {
log::warning log::warning
{ {
"IRCd main interrupted..." "IRCd main terminated..."
}; };
} }
catch(const std::exception &e) catch(const std::exception &e)
@ -249,15 +249,6 @@ catch(const std::exception &e)
"IRCd main exited: %s", e.what() "IRCd main exited: %s", e.what()
}; };
} }
catch(const ctx::terminated &)
{
log::warning
{
"IRCd main terminated..."
};
throw;
}
void void
ircd::at_main_exit() ircd::at_main_exit()

View file

@ -2546,10 +2546,6 @@ try
{ {
hook.function(event); hook.function(event);
} }
catch(const ctx::interrupted &e)
{
throw;
}
catch(const std::exception &e) catch(const std::exception &e)
{ {
log::critical log::critical

View file

@ -2849,7 +2849,6 @@ noexcept
void void
ircd::net::dns::resolver::sendq_worker() ircd::net::dns::resolver::sendq_worker()
try
{ {
while(1) while(1)
{ {
@ -2869,10 +2868,6 @@ try
sendq.pop_front(); sendq.pop_front();
} }
} }
catch(const ctx::interrupted &)
{
return;
}
void void
ircd::net::dns::resolver::flush(const queued &next) ircd::net::dns::resolver::flush(const queued &next)
@ -2900,7 +2895,6 @@ catch(const std::out_of_range &e)
void void
ircd::net::dns::resolver::timeout_worker() ircd::net::dns::resolver::timeout_worker()
try
{ {
while(1) while(1)
{ {
@ -2913,10 +2907,6 @@ try
check_timeouts(milliseconds(timeout)); check_timeouts(milliseconds(timeout));
} }
} }
catch(const ctx::interrupted &)
{
return;
}
void void
ircd::net::dns::resolver::check_timeouts(const milliseconds &timeout) ircd::net::dns::resolver::check_timeouts(const milliseconds &timeout)

View file

@ -327,10 +327,6 @@ try
{ {
m::join(room, user); m::join(room, user);
} }
catch(const ctx::interrupted &e)
{
throw;
}
catch(const std::exception &e) catch(const std::exception &e)
{ {
log::error log::error

View file

@ -185,7 +185,6 @@ calc_timesout(const resource::request &request)
void void
timeout_worker() timeout_worker()
try
{ {
while(1) while(1)
{ {
@ -198,13 +197,6 @@ try
ctx::sleep(seconds(5)); ctx::sleep(seconds(5));
} }
} }
catch(const ctx::interrupted &)
{
log::debug
{
"Typing timeout worker interrupted"
};
}
void void
timeout_check() timeout_check()

View file

@ -44,8 +44,8 @@ IRCD_MODULE
"federation sender", "federation sender",
nullptr, [] nullptr, []
{ {
sender.interrupt(); sender.terminate();
receiver.interrupt(); receiver.terminate();
sender.join(); sender.join();
receiver.join(); receiver.join();
} }
@ -53,7 +53,6 @@ IRCD_MODULE
void void
send_worker() send_worker()
try
{ {
// In order to synchronize with the vm core, this context has to // In order to synchronize with the vm core, this context has to
// maintain this shared_lock at all times. If this is unlocked we // maintain this shared_lock at all times. If this is unlocked we
@ -74,10 +73,6 @@ try
if(my(event)) if(my(event))
send(event); send(event);
} }
catch(const ircd::ctx::interrupted &e)
{
throw;
}
catch(const std::exception &e) catch(const std::exception &e)
{ {
log::error log::error
@ -86,13 +81,6 @@ try
}; };
} }
} }
catch(const ircd::ctx::interrupted &e)
{
log::debug
{
"Sender worker interrupted..."
};
}
void void
send(const m::event &event) send(const m::event &event)
@ -221,7 +209,6 @@ catch(const std::exception &e)
void void
recv_worker() recv_worker()
try
{ {
while(1) while(1)
{ {
@ -234,13 +221,6 @@ try
recv_timeouts(); recv_timeouts();
} }
} }
catch(const ircd::ctx::interrupted &e)
{
log::debug
{
"Receive worker interrupted..."
};
}
void void
recv() recv()
@ -288,10 +268,6 @@ try
node.flush(); node.flush();
} }
catch(const ctx::interrupted &e)
{
throw;
}
catch(const std::exception &e) catch(const std::exception &e)
{ {
ircd::assertion(e); ircd::assertion(e);
@ -345,10 +321,6 @@ try
return true; return true;
} }
catch(const ctx::interrupted &e)
{
throw;
}
catch(const http::error &e) catch(const http::error &e)
{ {
log::derror log::derror

View file

@ -65,10 +65,6 @@ try
for(const json::object &presence : push) for(const json::object &presence : push)
handle_edu_m_presence_(event, presence); handle_edu_m_presence_(event, presence);
} }
catch(const ctx::interrupted &)
{
throw;
}
catch(const std::exception &e) catch(const std::exception &e)
{ {
log::derror log::derror