Skip to main content

Module uloop

Module uloop 

Source
Expand description

Event loop (epoll tick shared with FilePoll).

Modules§

poll
Wave 74-LOOP-C.2: us_poll_* internal poll ABI + tagged ready-event dispatch.

Statics§

Bun__Node__UseSystemCA
Whether to load system CA certificates for TLS verification. Set by --use-system-ca / NODE_USE_SYSTEM_CA=1 upstream; default: load.

Functions§

BUN__warn__extra_ca_load_failed
Warning callback: root_certs.cpp calls this when a certificate file in the system CA directory cannot be parsed (the certs are skipped).
Bun__addrinfo_cancel
SAFETY: req must be a live request; socket a live connecting socket.
Bun__addrinfo_freeRequest
SAFETY: req must be a live request with exactly one outstanding handout being released by this call.
Bun__addrinfo_get
Query the shared cache / start resolution. See module docs for the return-value contract.
Bun__addrinfo_getRequestResult
SAFETY: req must be a live, completed request.
Bun__addrinfo_registerQuic
Legacy C-ABI registration kept for the internal.h declaration; no live C caller (the Rust h3 client uses Bun__addrinfo_registerQuic2 via bun_dns::internal::register_quic). Without a callback there is no way to deliver completion, so this is a no-op.
Bun__addrinfo_registerQuic2
QUIC registration with explicit threadsafe completion callback.
Bun__addrinfo_set
SAFETY: req must be a live request handed out by Bun__addrinfo_get, and socket a live us_connecting_socket_t on this thread’s loop.
Bun__internal_ensureDateHeaderTimerIsEnabled
Bun HTTP date header timer optimization. No-op in plain TCP mode. Called from us_internal_enable_sweep_timer in loop.c.
bao_loop_tick
Single-iteration event loop tick — Rust implementation. Does epoll_wait with controlled timeout (no NULL blocking) then dispatches via dispatch_ready_polls → C us_internal_dispatch_ready_poll for socket events.
bun_ssl_ctx_cache_on_free
BoringSSL CRYPTO_EX_free callback (openssl.c us_ctx_cache_ex_idx). Tombstones the SSLContextCache entry when the last SSL_CTX ref drops; safe no-op while no SSL_CTX cache is wired (every handshake gets a fresh SSL_CTX). Same shape the former stub/product defs had.
force_link
Force the linker to keep bao_uloop’s #[no_mangle] extern "C" symbols. BUG-353 fix: loop symbols (us_create_loop, uws_get_loop, etc.) are now extern “C” imports from libusockets.a/libuwsockets.a — no need to force-link them here. Only dispatch stubs and Bun__ addrinfo stubs remain local.
us_create_loop
Loop construction. Provided by libusockets.a (C, loop.c). Allocates sizeof(us_loop_t) + ext_size and initialises wakeup eventfd.
us_dispatch_close
Socket closed. Routes to group.vtable.on_close if available, else returns s.
us_dispatch_connect_error
Established socket connect error. Routes to group.vtable.on_connect_error if available, else returns s.
us_dispatch_connecting_error
Connecting socket error. Routes to group.vtable.on_connecting_error if available, else returns c.
us_dispatch_data
Socket received data. Routes to group.vtable.on_data if available, else returns s.
us_dispatch_end
Socket received FIN/EOF. Routes to group.vtable.on_end if available, else returns s.
us_dispatch_fd
Socket received fd (IPC). Routes to group.vtable.on_fd if available, else returns s.
us_dispatch_handshake
SSL handshake completion. Calls group.vtable.on_handshake if available. C signature: void us_dispatch_handshake(s, int success, us_bun_verify_error_t err). VTable callback signature: fn(s, int success, us_bun_verify_error_t, *mut c_void). The 4th argument (custom_data) is passed as null, matching Zig upstream.
us_dispatch_long_timeout
Socket long-timeout. Routes to group.vtable.on_long_timeout if available, else returns s.
us_dispatch_open
Socket opened (accept or connect completion). Routes to group.vtable.on_open if available, else returns s.
us_dispatch_ssl_raw_tap
SSL raw ciphertext tap. Returns s unchanged — no vtable hook for this.
us_dispatch_timeout
Socket timed out. Routes to group.vtable.on_timeout if available, else returns s.
us_dispatch_writable
Socket became writable. Routes to group.vtable.on_writable if available, else returns s.
us_loop_free
Loop destruction. Provided by libusockets.a (C, loop.c).
us_loop_run
Run until active==0. Provided by libusockets.a (C, loop.c).
us_wakeup_loop
Cross-thread wake. Provided by libusockets.a (C, loop.c).
uws_get_loop
Thread-local singleton loop accessor. Provided by libuwsockets.a (C++). Safe to call: returns a per-thread loop pointer, never null after init.
uws_loop_addPostHandler
Register a post-tick handler. Provided by libuwsockets.a (C++).
uws_loop_addPreHandler
Register a pre-tick handler. Provided by libuwsockets.a (C++).
uws_loop_defer
Defer a callback to next tick. Provided by libuwsockets.a (C++).
uws_loop_removePostHandler
Remove a post-tick handler. Provided by libuwsockets.a (C++).
uws_loop_removePreHandler
Remove a pre-tick handler. Provided by libuwsockets.a (C++).

Type Aliases§

DeferCb
LoopCb
LoopCtxCb