mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -05:00
Feature: Also route slow events to fastevent subsystem
This commit is contained in:
parent
cdd09669fa
commit
63cc9b9c2a
@ -18,6 +18,7 @@
|
|||||||
#include "event_log.h"
|
#include "event_log.h"
|
||||||
#include "event_exec.h"
|
#include "event_exec.h"
|
||||||
#include "event_url.h"
|
#include "event_url.h"
|
||||||
|
#include "fastevent.h"
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "admin.h"
|
#include "admin.h"
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
@ -334,6 +335,7 @@ void event_registration_push(event_registration_t **er, event_registration_t *ta
|
|||||||
|
|
||||||
/* event signaling */
|
/* event signaling */
|
||||||
void event_emit(event_t *event) {
|
void event_emit(event_t *event) {
|
||||||
|
fastevent_emit(FASTEVENT_TYPE_SLOWEVENT, FASTEVENT_FLAG_NONE, FASTEVENT_DATATYPE_EVENT, event);
|
||||||
thread_mutex_lock(&event_lock);
|
thread_mutex_lock(&event_lock);
|
||||||
event_push(&event_queue, event);
|
event_push(&event_queue, event);
|
||||||
thread_mutex_unlock(&event_lock);
|
thread_mutex_unlock(&event_lock);
|
||||||
@ -371,11 +373,13 @@ void event_emit_clientevent(const char *trigger, client_t *client, const char *u
|
|||||||
* We do this before inserting all the data into the object to avoid
|
* We do this before inserting all the data into the object to avoid
|
||||||
* all the strdups() and stuff in case they aren't needed.
|
* all the strdups() and stuff in case they aren't needed.
|
||||||
*/
|
*/
|
||||||
|
#ifndef FASTEVENT_ENABLED
|
||||||
if (event->reglist[0] == NULL) {
|
if (event->reglist[0] == NULL) {
|
||||||
/* we have no registrations, drop this event. */
|
/* we have no registrations, drop this event. */
|
||||||
event_release(event);
|
event_release(event);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (client) {
|
if (client) {
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
|
26
src/main.c
26
src/main.c
@ -120,12 +120,35 @@ static void _stop_logging(void)
|
|||||||
log_close(playlistlog);
|
log_close(playlistlog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef FASTEVENT_ENABLED
|
||||||
|
static void __fastevent_cb(const void *userdata, fastevent_type_t type, fastevent_flag_t flags, fastevent_datatype_t datatype, va_list ap)
|
||||||
|
{
|
||||||
|
event_t *event;
|
||||||
|
|
||||||
|
if (datatype != FASTEVENT_DATATYPE_EVENT)
|
||||||
|
return;
|
||||||
|
|
||||||
|
event = va_arg(ap, event_t*);
|
||||||
|
|
||||||
|
if (event == NULL) {
|
||||||
|
ICECAST_LOG_DEBUG("event=%p", event);
|
||||||
|
} else {
|
||||||
|
ICECAST_LOG_DEBUG("event=%p{.trigger='%s', ...}", event, event->trigger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static refobject_t fastevent_reg;
|
||||||
|
#endif
|
||||||
|
|
||||||
static void initialize_subsystems(void)
|
static void initialize_subsystems(void)
|
||||||
{
|
{
|
||||||
log_initialize();
|
log_initialize();
|
||||||
thread_initialize();
|
thread_initialize();
|
||||||
global_initialize();
|
global_initialize();
|
||||||
|
#ifndef FASTEVENT_ENABLED
|
||||||
fastevent_initialize();
|
fastevent_initialize();
|
||||||
|
fastevent_reg = fastevent_register(FASTEVENT_TYPE_SLOWEVENT, __fastevent_cb, NULL, NULL);
|
||||||
|
#endif
|
||||||
sock_initialize();
|
sock_initialize();
|
||||||
resolver_initialize();
|
resolver_initialize();
|
||||||
config_initialize();
|
config_initialize();
|
||||||
@ -154,7 +177,10 @@ static void shutdown_subsystems(void)
|
|||||||
config_shutdown();
|
config_shutdown();
|
||||||
resolver_shutdown();
|
resolver_shutdown();
|
||||||
sock_shutdown();
|
sock_shutdown();
|
||||||
|
#ifndef FASTEVENT_ENABLED
|
||||||
|
refobject_unref(fastevent_reg);
|
||||||
fastevent_shutdown();
|
fastevent_shutdown();
|
||||||
|
#endif
|
||||||
global_shutdown();
|
global_shutdown();
|
||||||
thread_shutdown();
|
thread_shutdown();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user