From c1672b280f32fe5d69698360cd9a5c9762f68bcd Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 16 Mar 2020 14:14:14 -0700 Subject: [PATCH] ircd::m::typing: Report error from timeout worker context; minor cleanup. --- matrix/typing.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/matrix/typing.cc b/matrix/typing.cc index be3c762b8..fb48b8c2f 100644 --- a/matrix/typing.cc +++ b/matrix/typing.cc @@ -29,10 +29,10 @@ struct typist bool operator()(const typist &a, const typist &b) const; }; -ctx::dock +static ctx::dock timeout_dock; -std::set +static std::set typists; conf::item @@ -318,7 +318,9 @@ ircd::m::typing::for_each(const closure &closure) static void timeout_timeout(const typist &); static bool timeout_check(); static void timeout_worker(); -static context timeout_context + +static context +timeout_context { "typing", 256_KiB, @@ -336,8 +338,8 @@ timeout_context_terminate }; void -__attribute__((noreturn)) timeout_worker() +try { while(1) { @@ -350,6 +352,14 @@ timeout_worker() ctx::sleep(milliseconds(timeout_int)); } } +catch(const std::exception &e) +{ + log::critical + { + typing_log, "Typing timeout worker fatal :%s", + e.what() + }; +} bool timeout_check()