Skip to content

Comments

eio backend, second attempt#95

Merged
c-cube merged 19 commits intomainfrom
simon/use-eio-round2
Feb 15, 2026
Merged

eio backend, second attempt#95
c-cube merged 19 commits intomainfrom
simon/use-eio-round2

Conversation

@c-cube
Copy link
Owner

@c-cube c-cube commented May 1, 2025

this simply adds a Eio backend to tiny_httpd, for cooperative concurrency.

@vphantom
Copy link
Contributor

vphantom commented May 2, 2025

Are you migrating to Eio or adding it as an option?

@c-cube
Copy link
Owner Author

c-cube commented May 2, 2025 via email

@c-cube c-cube force-pushed the simon/use-eio-round2 branch from 169c19b to d9c0f94 Compare June 7, 2025 02:26
provides a tiny_httpd server that relies on Eio for non-blocking
sockets and for concurrency using eio fibers.
@c-cube c-cube force-pushed the simon/use-eio-round2 branch from d9c0f94 to 94ed68c Compare February 15, 2026 20:13
- Add closed flag to ic_of_flow/oc_of_flow to prevent double-release of
  pool cstructs and double-shutdown
- Enforce max_connections with Eio.Semaphore to limit concurrent connections
- Fix port 0 detection using Eio.Net.listening_addr to return actual port
- Use pool_size for cstruct pool max_size (was computed but unused)
- Set TCP_NODELAY on accepted connections for low latency
- small_list -> list_small
- bytes_of_size -> bytes_size
- small_nat -> nat_small
- prefix unused Frame_type constants with underscore
@c-cube c-cube force-pushed the simon/use-eio-round2 branch from bbeece1 to 32421a2 Compare February 15, 2026 21:09
- Acquire semaphore BEFORE spawning handler fiber: replace
  Eio.Net.accept_fork with manual accept + Semaphore.acquire + Fiber.fork
  so we bound the number of in-flight fibers rather than spawning
  unlimited fibers that all block on the semaphore.

- Graceful stop: remove Eio.Switch.fail sw Exit from stop(), just set
  running to false so existing handlers can complete naturally instead
  of being cancelled immediately.

- Replace Unix.gettimeofday with Eio.Time.now clock to use the Eio
  clock abstraction instead of direct Unix calls.
* eio-fixes:
  eio: add 60s shutdown backstop, protect Flow.close from raising
  eio: fix semaphore acquisition, graceful stop, and time source
@c-cube c-cube marked this pull request as ready for review February 15, 2026 21:36
@c-cube c-cube merged commit a07936d into main Feb 15, 2026
4 checks passed
@c-cube c-cube deleted the simon/use-eio-round2 branch February 15, 2026 21:36
c-cube added a commit to c-cube/opam-repository that referenced this pull request Feb 16, 2026
CHANGES:

- eio backend, second try (c-cube/tiny_httpd#95)
- hardening bugfixes
- feat WS: abstraction for critical section
- feat route: add `to_url`, to produce a URL path from a route
- fix some warnings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants