void kore_platform_event_init(void) { if ((kfd = kqueue()) == -1) fatal("kqueue(): %s", errno_s); nchanges = 0; event_count = worker_max_connections + 1; events = kore_calloc(event_count, sizeof(struct kevent)); changelist = kore_calloc(event_count, sizeof(struct kevent)); kore_platform_event_schedule(server.fd, EVFILT_READ, EV_ADD | EV_DISABLE, &server); }
void kore_platform_event_init(void) { if ((efd = epoll_create(10000)) == -1) fatal("epoll_create(): %s", errno_s); event_count = worker_max_connections + 1; events = kore_calloc(event_count, sizeof(struct epoll_event)); }
void connection_new(struct connection *c) { struct kore_pgsql *pgsql; c->disconnect = connection_del; c->proto = CONN_PROTO_UNKNOWN; c->state = CONN_STATE_ESTABLISHED; pgsql = kore_calloc(1, sizeof(*pgsql)); kore_pgsql_init(pgsql); kore_pgsql_bind_callback(pgsql, db_state_change, c); c->hdlr_extra = pgsql; printf("new connection %p\n", (void *)c); db_init(c, pgsql); }