Commit 1a38fba7 authored by Scott Vokes's avatar Scott Vokes
Browse files

Break up listener.c into listener{,_cmd,_io,_task}.c.

This clarifies the dataflow better, and breaks up a large file.
parent 20899616
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -84,6 +84,9 @@ LIB_OBJS = \
	$(OUT_DIR)/bus.o \
	$(OUT_DIR)/bus_ssl.o \
	$(OUT_DIR)/listener.o \
	$(OUT_DIR)/listener_cmd.o \
	$(OUT_DIR)/listener_io.o \
	$(OUT_DIR)/listener_task.o \
	$(OUT_DIR)/send.o \
	$(OUT_DIR)/util.o \
	$(OUT_DIR)/yacht.o \
+3 −0
Original line number Diff line number Diff line
@@ -11,6 +11,9 @@ BUS_OBJS = \
	bus.o \
	bus_ssl.o \
	listener.o \
	listener_cmd.o \
	listener_io.o \
	listener_task.o \
	send.o \
	util.o \
	yacht.o \
+3 −4
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@
#include "yacht.h"
#include "atomic.h"

#include "listener_task.h"

static bool poll_on_completion(struct bus *b, int fd);
static int listener_id_of_socket(struct bus *b, int fd);
static void noop_log_cb(log_event_t event,
@@ -45,9 +47,6 @@ static void noop_log_cb(log_event_t event,
static void noop_error_cb(bus_unpack_cb_res_t result, void *socket_udata);
static bool attempt_to_increase_resource_limits(struct bus *b);

/* Function pointer for pthread start function. */
void *listener_mainloop(void *arg);

static void set_defaults(bus_config *cfg) {
    if (cfg->listener_count == 0) { cfg->listener_count = 1; }
}
@@ -154,7 +153,7 @@ bool bus_init(bus_config *config, struct bus_result *res) {

    for (int i = 0; i < b->listener_count; i++) {
        int pcres = pthread_create(&b->threads[i], NULL,
            listener_mainloop, (void *)b->listeners[i]);
            ListenerTask_MainLoop, (void *)b->listeners[i]);
        if (pcres != 0) {
            res->status = BUS_INIT_ERROR_PTHREAD_INIT_FAIL;
            goto cleanup;
+21 −1132

File changed.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ bool listener_expect_response(struct listener *l, boxed_msg *box,
/* Shut down the listener. Blocking. */
bool listener_shutdown(struct listener *l, int *notify_fd);

/* Free the listener, which must already be shut down. */
void listener_free(struct listener *l);

#endif
Loading