MQTT 3.1 and 5 in OCaml using Eio
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add connection-lifetime switches and HTTP/2 true multiplexing

Conpool changes:
- Add connection-lifetime switch passed to protocol init_state, enabling
long-running fibers (e.g., HTTP/2 background reader)
- Add on_acquire/on_release protocol hooks for lazy fiber initialization
- Enforce max_idle_time via pc_last_used tracking
- Enforce max_connection_uses via pc_use_count tracking
- Track idle count (connections with no active users)
- Track error count (protocol failures vs normal lifecycle closes)
- Distinguish Unhealthy_error from Unhealthy_lifecycle in health checks

HTTP/2 changes:
- Enable true multiplexing: access_mode now returns Shared
- Start background reader fiber on first acquire (lazy init)
- Add on_goaway callback to start_reader for GOAWAY notifications
- Use concurrent request path instead of synchronous

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

+3 -3
+1 -1
lib/cmd/mqtte_cmd.mli
··· 104 104 ?insecure:bool -> 105 105 pool_config:Conpool.Config.t -> 106 106 unit -> 107 - Conpool.t 107 + unit Conpool.t 108 108 (** [create_pool ~sw ~net ~clock ~tls ?insecure ~pool_config ()] creates a 109 109 connection pool with optional TLS configuration. 110 110
+2 -2
lib/eio/client.ml
··· 411 411 Log.info (fun m -> 412 412 m "Connecting to %s:%d as %s (via pool)" host port config.client_id); 413 413 let conn = Conpool.connection ~sw pool endpoint in 414 - let flow = (conn :> Eio.Flow.two_way_ty Eio.Resource.t) in 415 - let close_flow () = Eio.Resource.close conn in 414 + let flow = (conn.Conpool.flow :> Eio.Flow.two_way_ty Eio.Resource.t) in 415 + let close_flow () = Eio.Resource.close conn.Conpool.flow in 416 416 connect_with_flow ~sw ~clock ?on_message ?on_disconnect ~config ~close_flow 417 417 flow 418 418