void * as_netio_th(void *q_to_wait_on) { cf_queue * q = (cf_queue*)q_to_wait_on; while (true) { as_netio io; if (cf_queue_pop(q, &io, CF_QUEUE_FOREVER) != 0) { cf_crash(AS_PROTO, "Failed to pop from IO worker queue."); } if (io.slow) { usleep(g_config.proto_slow_netio_sleep_ms * 1000); } as_netio_send(&io, g_netio_slow_queue, false); } }
void * as_netio_th(void *q_to_wait_on) { cf_queue * q = (cf_queue*)q_to_wait_on; while (true) { as_netio io; if (cf_queue_pop(q, &io, CF_QUEUE_FOREVER) != 0) { cf_crash(AS_PROTO, "Failed to pop from IO worker queue."); } if (io.slow) { usleep(g_config.proto_slow_netio_sleep_ms * 1000); } if (as_netio_send(&io, g_netio_slow_queue, false) != AS_NETIO_CONTINUE) { AS_RELEASE_FILE_HANDLE(io.fd_h); cf_buf_builder_free(io.bb_r); }; } }