void bud_worker_read_cb(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { uv_pipe_t* pipe; bud_config_t* config; pipe = (uv_pipe_t*) stream; config = pipe->data; ASSERT(config != NULL, "worker ipc failed to get config"); ASSERT(nread >= 0 || nread == UV_EOF, "worker ipc read failure"); while (uv_pipe_pending_count(pipe) > 0) { uv_handle_type pending; pending = uv_pipe_pending_type(pipe); /* Ignore reads without handles */ if (pending == UV_UNKNOWN_HANDLE) return; ASSERT(pending == UV_TCP, "worker received non-tcp handle on ipc"); bud_log(config, kBudLogDebug, "worker received handle"); /* Accept client */ bud_client_create(config, (uv_stream_t*) config->ipc); } }
void bud_worker_ipc_client_cb(bud_ipc_t* ipc) { /* Accept client */ bud_client_create(ipc->config, bud_ipc_get_stream(ipc)); }