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=1upstream; default: load.
Functions§
- BUN__
warn__ ⚠extra_ ca_ load_ failed - Warning callback:
root_certs.cppcalls this when a certificate file in the system CA directory cannot be parsed (the certs are skipped). - Bun__
addrinfo_ ⚠cancel - SAFETY:
reqmust be a live request;socketa live connecting socket. - Bun__
addrinfo_ ⚠free Request - SAFETY:
reqmust 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_ ⚠getRequest Result - SAFETY:
reqmust be a live, completed request. - Bun__
addrinfo_ ⚠register Quic - Legacy C-ABI registration kept for the internal.h declaration; no live C
caller (the Rust h3 client uses
Bun__addrinfo_registerQuic2viabun_dns::internal::register_quic). Without a callback there is no way to deliver completion, so this is a no-op. - Bun__
addrinfo_ ⚠register Quic2 - QUIC registration with explicit threadsafe completion callback.
- Bun__
addrinfo_ ⚠set - SAFETY:
reqmust be a live request handed out byBun__addrinfo_get, andsocketa liveus_connecting_socket_ton this thread’s loop. - Bun__
internal_ ⚠ensure Date Header Timer IsEnabled - 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_waitwith controlled timeout (no NULL blocking) then dispatches viadispatch_ready_polls→ Cus_internal_dispatch_ready_pollfor 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_closeif available, else returnss. - us_
dispatch_ ⚠connect_ error - Established socket connect error.
Routes to
group.vtable.on_connect_errorif available, else returnss. - us_
dispatch_ ⚠connecting_ error - Connecting socket error.
Routes to
group.vtable.on_connecting_errorif available, else returnsc. - us_
dispatch_ ⚠data - Socket received data.
Routes to
group.vtable.on_dataif available, else returnss. - us_
dispatch_ ⚠end - Socket received FIN/EOF.
Routes to
group.vtable.on_endif available, else returnss. - us_
dispatch_ ⚠fd - Socket received fd (IPC).
Routes to
group.vtable.on_fdif available, else returnss. - us_
dispatch_ ⚠handshake - SSL handshake completion. Calls
group.vtable.on_handshakeif 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_timeoutif available, else returnss. - us_
dispatch_ ⚠open - Socket opened (accept or connect completion).
Routes to
group.vtable.on_openif available, else returnss. - us_
dispatch_ ⚠ssl_ raw_ tap - SSL raw ciphertext tap. Returns
sunchanged — no vtable hook for this. - us_
dispatch_ ⚠timeout - Socket timed out.
Routes to
group.vtable.on_timeoutif available, else returnss. - us_
dispatch_ ⚠writable - Socket became writable.
Routes to
group.vtable.on_writableif available, else returnss. - 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_ ⚠addPost Handler - Register a post-tick handler. Provided by libuwsockets.a (C++).
- uws_
loop_ ⚠addPre Handler - 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_ ⚠remove Post Handler - Remove a post-tick handler. Provided by libuwsockets.a (C++).
- uws_
loop_ ⚠remove PreHandler - Remove a pre-tick handler. Provided by libuwsockets.a (C++).