diff --git a/server/include/hooks.h b/server/include/hooks.h index a8994d726..8cc8094ae 100644 --- a/server/include/hooks.h +++ b/server/include/hooks.h @@ -54,6 +54,7 @@ enum hook_type { HOOK_PRE, /**< Called when a new packet of messages (samples) was received. */ HOOK_POST, /**< Called after each message (sample) of a packet was processed. */ HOOK_MSG, /**< Called for each message (sample) in a packet. */ + HOOK_ASYNC, /**< Called asynchronously with fixed rate (see path::rate). */ HOOK_PERIODIC, /**< Called periodically. Period is set by global 'stats' option in the configuration file. */ diff --git a/server/src/path.c b/server/src/path.c index 2143d68b3..7586bbb5b 100644 --- a/server/src/path.c +++ b/server/src/path.c @@ -54,8 +54,12 @@ static void * path_run_async(void *arg) struct path *p = arg; /* Block until 1/p->rate seconds elapsed */ - while (timerfd_wait(p->tfd)) + while (timerfd_wait(p->tfd)) { + if (path_run_hook(p, HOOK_ASYNC)) + continue; + path_write(p); + } return NULL; }