Skip to main content

moq_server_listen

Function moq_server_listen 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn moq_server_listen( config: *const moq_server_config, on_request: moq_status_callback, user_data: *mut c_void, ) -> i32
Expand description

Listen for incoming sessions.

Binds before returning, so a bad address or certificate fails here with a reason in moq_error. Returns a non-zero server handle on success, or a negative code on failure.

on_request is called with a positive session request handle for each incoming session, then exactly once more with a terminal code: 0 (stopped cleanly, including after moq_server_close) or a negative error. After the terminal (<= 0) callback, user_data is never touched again, so release it there. Answer each request with moq_session_request_accept, moq_session_request_reject, or moq_session_request_free.

ยงSafety

  • config must point at a readable moq_server_config whose non-NULL pointers are valid for their paired lengths during this call.
  • The caller must keep user_data valid until the terminal (<= 0) on_request callback.