0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-19 08:21:09 +01:00

ircd:Ⓜ️ Cope with raii fails in m::init for right now.

This commit is contained in:
Jason Volk 2018-03-17 21:37:33 -07:00
parent 2b72fae7a1
commit 1780504cba
2 changed files with 7 additions and 1 deletions

View file

@ -72,6 +72,7 @@ namespace ircd
struct ircd::m::init struct ircd::m::init
{ {
json::object config; json::object config;
bool joined {false};
void bootstrap(); void bootstrap();
void listeners(); void listeners();

View file

@ -108,15 +108,18 @@ try
bootstrap(); bootstrap();
join_ircd_room(); join_ircd_room();
joined = true;
listeners(); listeners();
} }
catch(const m::error &e) catch(const m::error &e)
{ {
this->~init();
log.error("%s %s", e.what(), e.content); log.error("%s %s", e.what(), e.content);
throw; throw;
} }
catch(const std::exception &e) catch(const std::exception &e)
{ {
this->~init();
log.error("%s", e.what()); log.error("%s", e.what());
throw; throw;
} }
@ -124,7 +127,9 @@ catch(const std::exception &e)
ircd::m::init::~init() ircd::m::init::~init()
noexcept try noexcept try
{ {
if(joined)
leave_ircd_room(); leave_ircd_room();
m::listeners.clear(); m::listeners.clear();
m::modules.clear(); m::modules.clear();
} }