TCP/TLS connection pooling for Eio

fix-reuse

+5 -2
+5 -2
lib/conpool.ml
··· 450 450 Eio.Mutex.use_rw ~protect:true ep_pool.mutex (fun () -> 451 451 ep_pool.stats.active <- ep_pool.stats.active + 1); 452 452 453 - (* Fork a daemon fiber to manage the connection lifecycle *) 454 - Eio.Fiber.fork_daemon ~sw (fun () -> 453 + (* Fork a daemon fiber to manage the connection lifecycle. 454 + Important: Fork under pool.sw, not the caller's sw, so the daemon 455 + survives when the caller's switch ends and can return the connection 456 + to the pool for reuse. *) 457 + Eio.Fiber.fork_daemon ~sw:pool.sw (fun () -> 455 458 Fun.protect 456 459 ~finally:(fun () -> 457 460 (* Decrement active count *)