pub struct UdpListener { /* private fields */ }Expand description
One UDP listener: a single mio::net::UdpSocket plus its routing config.
Unlike a TCP listener there is no accept loop — a readable event is a batch
of datagrams the session drains to WouldBlock.
Implementations§
Source§impl UdpListener
impl UdpListener
Sourcepub fn validate_config(_config: &UdpListenerConfig) -> Result<(), ListenerError>
pub fn validate_config(_config: &UdpListenerConfig) -> Result<(), ListenerError>
Validate that a worker can build this UDP listener configuration WITHOUT
constructing the full listener or binding a socket. UDP listener
construction has no fallible config today (no rustls context, no answer
templates; a bad bind surfaces later as an ActivateListener failure),
so this currently always succeeds. It exists for surface parity with the
HTTP/HTTPS validators the main process calls before committing an
Add*Listener to ConfigState and fanning it out (sozu#1301), and is
the hook for any future UDP-config validation.
Sourcepub fn activate(
&mut self,
registry: &Registry,
udp_socket: Option<UdpSocket>,
) -> Result<Token, ProxyError>
pub fn activate( &mut self, registry: &Registry, udp_socket: Option<UdpSocket>, ) -> Result<Token, ProxyError>
Bind (or adopt an SCM-passed) socket and register it READABLE. The
READABLE registration is what drives Server::ready for this listener —
there is no accept path.
Sourcepub fn update_config(&mut self, patch: &UpdateUdpListenerConfig)
pub fn update_config(&mut self, patch: &UpdateUdpListenerConfig)
Apply a partial-update patch to this UDP listener’s live config. Fields
absent in the patch (None) are preserved.