Loading src/lib/bus/bus.c +0 −17 Original line number Diff line number Diff line Loading @@ -105,11 +105,6 @@ bool Bus_Init(bus_config *config, struct bus_result *res) { b->log_cb = config->log_cb; b->log_level = config->log_level; b->udata = config->bus_udata; if (0 != pthread_mutex_init(&b->log_lock, NULL)) { res->status = BUS_INIT_ERROR_MUTEX_INIT_FAIL; goto cleanup; } locks_initialized++; if (0 != pthread_mutex_init(&b->fd_set_lock, NULL)) { res->status = BUS_INIT_ERROR_MUTEX_INIT_FAIL; goto cleanup; Loading Loading @@ -188,9 +183,6 @@ cleanup: if (locks_initialized > 1) { pthread_mutex_destroy(&b->fd_set_lock); } if (locks_initialized > 0) { pthread_mutex_destroy(&b->log_lock); } free(b); } Loading Loading @@ -567,14 +559,6 @@ void Bus_BackpressureDelay(struct bus *b, size_t backpressure, uint8_t shift) { } } void Bus_LockLog(struct bus *b) { pthread_mutex_lock(&b->log_lock); } void Bus_UnlockLog(struct bus *b) { pthread_mutex_unlock(&b->log_lock); } static void box_execute_cb(void *udata) { boxed_msg *box = (boxed_msg *)udata; Loading Loading @@ -644,7 +628,6 @@ void Bus_Free(bus *b) { free(b->joined); free(b->threads); pthread_mutex_destroy(&b->fd_set_lock); pthread_mutex_destroy(&b->log_lock); BusSSL_CtxFree(b); free(b); Loading src/lib/bus/bus_internal_types.h +0 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,6 @@ typedef struct bus { int log_level; bus_log_cb *log_cb; pthread_mutex_t log_lock; uint8_t listener_count; struct listener **listeners; Loading src/lib/bus/bus_inward.h +0 −4 Original line number Diff line number Diff line Loading @@ -29,10 +29,6 @@ const char *Bus_LogEventStr(log_event_t event); * This will level sockets between multiple threads. */ struct listener *Bus_GetListenerForSocket(struct bus *b, int fd); /* Lock / unlock the log mutex, since logging can occur on several threads. */ void Bus_LockLog(struct bus *b); void Bus_UnlockLog(struct bus *b); /* Deliver a boxed message to the thread pool to execute. */ bool Bus_ProcessBoxedMessage(struct bus *b, struct boxed_msg *box, size_t *backpressure); Loading src/lib/bus/bus_types.h +0 −4 Original line number Diff line number Diff line Loading @@ -50,9 +50,7 @@ struct boxed_msg; char *_msg = MSG; \ void *_udata = UDATA; \ if (_b->log_level >= _level && _b->log_cb != NULL) { \ Bus_LockLog(_b); \ _b->log_cb(_event_key, _level, _msg, _udata); \ Bus_UnlockLog(_b); \ } \ } while (0) Loading @@ -65,7 +63,6 @@ struct boxed_msg; log_event_t _event_key = EVENT_KEY; \ void *_udata = UDATA; \ if (_b->log_level >= _level && _b->log_cb != NULL) { \ Bus_LockLog(_b); \ char _log_buf[MAX_SZ]; \ if (MAX_SZ < snprintf(_log_buf, MAX_SZ, \ FMT, __VA_ARGS__)) { \ Loading @@ -79,7 +76,6 @@ struct boxed_msg; } else { \ _b->log_cb(_event_key, _level, _log_buf, _udata); \ } \ Bus_UnlockLog(_b); \ } \ } while (0) #endif Loading src/lib/bus/listener_io.c +0 −2 Original line number Diff line number Diff line Loading @@ -219,14 +219,12 @@ static bool sink_socket_read(struct bus *b, "read %zd bytes, calling sink CB", size); #if DUMP_READ Bus_LockLog(b); printf("\n"); for (int i = 0; i < size; i++) { if (i > 0 && (i & 15) == 0) { printf("\n"); } printf("%02x ", l->read_buf[i]); } printf("\n\n"); Bus_UnlockLog(b); #endif bus_sink_cb_res_t sres = b->sink_cb(l->read_buf, size, ci->udata); Loading Loading
src/lib/bus/bus.c +0 −17 Original line number Diff line number Diff line Loading @@ -105,11 +105,6 @@ bool Bus_Init(bus_config *config, struct bus_result *res) { b->log_cb = config->log_cb; b->log_level = config->log_level; b->udata = config->bus_udata; if (0 != pthread_mutex_init(&b->log_lock, NULL)) { res->status = BUS_INIT_ERROR_MUTEX_INIT_FAIL; goto cleanup; } locks_initialized++; if (0 != pthread_mutex_init(&b->fd_set_lock, NULL)) { res->status = BUS_INIT_ERROR_MUTEX_INIT_FAIL; goto cleanup; Loading Loading @@ -188,9 +183,6 @@ cleanup: if (locks_initialized > 1) { pthread_mutex_destroy(&b->fd_set_lock); } if (locks_initialized > 0) { pthread_mutex_destroy(&b->log_lock); } free(b); } Loading Loading @@ -567,14 +559,6 @@ void Bus_BackpressureDelay(struct bus *b, size_t backpressure, uint8_t shift) { } } void Bus_LockLog(struct bus *b) { pthread_mutex_lock(&b->log_lock); } void Bus_UnlockLog(struct bus *b) { pthread_mutex_unlock(&b->log_lock); } static void box_execute_cb(void *udata) { boxed_msg *box = (boxed_msg *)udata; Loading Loading @@ -644,7 +628,6 @@ void Bus_Free(bus *b) { free(b->joined); free(b->threads); pthread_mutex_destroy(&b->fd_set_lock); pthread_mutex_destroy(&b->log_lock); BusSSL_CtxFree(b); free(b); Loading
src/lib/bus/bus_internal_types.h +0 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,6 @@ typedef struct bus { int log_level; bus_log_cb *log_cb; pthread_mutex_t log_lock; uint8_t listener_count; struct listener **listeners; Loading
src/lib/bus/bus_inward.h +0 −4 Original line number Diff line number Diff line Loading @@ -29,10 +29,6 @@ const char *Bus_LogEventStr(log_event_t event); * This will level sockets between multiple threads. */ struct listener *Bus_GetListenerForSocket(struct bus *b, int fd); /* Lock / unlock the log mutex, since logging can occur on several threads. */ void Bus_LockLog(struct bus *b); void Bus_UnlockLog(struct bus *b); /* Deliver a boxed message to the thread pool to execute. */ bool Bus_ProcessBoxedMessage(struct bus *b, struct boxed_msg *box, size_t *backpressure); Loading
src/lib/bus/bus_types.h +0 −4 Original line number Diff line number Diff line Loading @@ -50,9 +50,7 @@ struct boxed_msg; char *_msg = MSG; \ void *_udata = UDATA; \ if (_b->log_level >= _level && _b->log_cb != NULL) { \ Bus_LockLog(_b); \ _b->log_cb(_event_key, _level, _msg, _udata); \ Bus_UnlockLog(_b); \ } \ } while (0) Loading @@ -65,7 +63,6 @@ struct boxed_msg; log_event_t _event_key = EVENT_KEY; \ void *_udata = UDATA; \ if (_b->log_level >= _level && _b->log_cb != NULL) { \ Bus_LockLog(_b); \ char _log_buf[MAX_SZ]; \ if (MAX_SZ < snprintf(_log_buf, MAX_SZ, \ FMT, __VA_ARGS__)) { \ Loading @@ -79,7 +76,6 @@ struct boxed_msg; } else { \ _b->log_cb(_event_key, _level, _log_buf, _udata); \ } \ Bus_UnlockLog(_b); \ } \ } while (0) #endif Loading
src/lib/bus/listener_io.c +0 −2 Original line number Diff line number Diff line Loading @@ -219,14 +219,12 @@ static bool sink_socket_read(struct bus *b, "read %zd bytes, calling sink CB", size); #if DUMP_READ Bus_LockLog(b); printf("\n"); for (int i = 0; i < size; i++) { if (i > 0 && (i & 15) == 0) { printf("\n"); } printf("%02x ", l->read_buf[i]); } printf("\n\n"); Bus_UnlockLog(b); #endif bus_sink_cb_res_t sres = b->sink_cb(l->read_buf, size, ci->udata); Loading