EV-Websockets
view release on metacpan or search on metacpan
Websockets.xs view on Meta::CPAN
}
/* Schedule the next lws housekeeping wake-up.
lws_service_adjust_timeout returns the ms until lws next needs servicing; 0
means "service as soon as possible". This timer only paces lws's time-based
work (connection/handshake timeouts, TLS cert aging, draining buffered rx) --
socket readability/writability is driven by the per-fd io watcher, not here.
We deliberately floor the delay at 1ms rather than arming an ev_idle watcher
on 0: do_lws_service is now non-blocking, so an always-ready idle watcher
would busy-spin at 100% CPU whenever lws keeps asking for immediate service.
A 1ms floor lets the loop block briefly so every other EV watcher still
fires, at negligible latency for this coarse, time-based work. */
static void schedule_timeout(ev_ws_ctx_t* ctx) {
int delay_ms = lws_service_adjust_timeout(ctx->lws_ctx, 1000, 0);
double delay_s;
if (delay_ms < 1) delay_ms = 1;
delay_s = (double)delay_ms / 1000.0;
ev_timer_stop(ctx->loop, &ctx->timer);
( run in 0.851 second using v1.01-cache-2.11-cpan-600a1bdf6e4 )