From f2283ec1b4e52a3076b1c5e386b35f87b8361437 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Sun, 17 Aug 2014 13:37:07 -0400 Subject: [PATCH] closing fd's is sometimes helpful We don't have connection pooling for the client anyway so at least don't be so buggy and close fd's after every request. --- async/cohttp_async.ml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/async/cohttp_async.ml b/async/cohttp_async.ml index 198cb1fe6f..fa5897791d 100644 --- a/async/cohttp_async.ml +++ b/async/cohttp_async.ml @@ -155,6 +155,10 @@ module Client = struct | `Ok res -> (* Build a response pipe for the body *) let rd = pipe_of_body (Response.read_body_chunk res) ic oc in + don't_wait_for ( + Pipe.closed rd >>= fun () -> + Deferred.all_ignore [Reader.close ic; Writer.close oc] + ); return (res, `Pipe rd) let get ?interrupt ?headers uri =