Lines Matching defs:context

58         Context *context;
75 if (c->context)
76 set_remove(c->context->connections, c);
92 static void context_free(Context *context) {
96 assert(context);
98 while ((es = set_steal_first(context->listen)))
101 while ((c = set_first(context->connections)))
104 set_free(context->listen);
105 set_free(context->connections);
107 sd_event_unref(context->event);
108 sd_resolve_unref(context->resolve);
255 r = sd_event_add_io(c->context->event, &c->server_event_source, c->server_fd, a, traffic_cb, c);
265 r = sd_event_add_io(c->context->event, &c->client_event_source, c->client_fd, b, traffic_cb, c);
345 r = sd_event_add_io(c->context->event, &c->client_event_source, c->client_fd, EPOLLOUT, connect_cb, c);
437 r = sd_resolve_getaddrinfo(c->context->resolve, &c->resolve_query, node, service, &hints, resolve_cb, c);
450 static int add_connection_socket(Context *context, int fd) {
454 assert(context);
457 if (set_size(context->connections) > CONNECTIONS_MAX) {
463 r = set_ensure_allocated(&context->connections, NULL);
475 c->context = context;
481 r = set_put(context->connections, c);
493 Context *context = userdata;
499 assert(context);
509 r = add_connection_socket(context, nfd);
519 sd_event_exit(context->event, r);
526 static int add_listen_socket(Context *context, int fd) {
530 assert(context);
533 r = set_ensure_allocated(&context->listen, NULL);
551 r = sd_event_add_io(context->event, &source, fd, EPOLLIN, accept_cb, context);
555 r = set_put(context->listen, source);
631 Context context = {};
641 r = sd_event_default(&context.event);
647 r = sd_resolve_default(&context.resolve);
653 r = sd_resolve_attach_event(context.resolve, context.event, 0);
659 sd_event_set_watchdog(context.event, true);
673 r = add_listen_socket(&context, fd);
678 r = sd_event_loop(context.event);
685 context_free(&context);