From 0eb918a6544a7ac45593e69b633fd42fd8a41b9b Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Mon, 29 May 2006 16:54:36 +0000 Subject: [PATCH] ensure connections get closed after having been served --- helm/software/daemons/http_getter/main.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/helm/software/daemons/http_getter/main.ml b/helm/software/daemons/http_getter/main.ml index c200c161d..572e9de1b 100644 --- a/helm/software/daemons/http_getter/main.ml +++ b/helm/software/daemons/http_getter/main.ml @@ -263,7 +263,7 @@ let respond_xslt patch_xslt xslt_name outchan = (* thread action *) -let callback (req: Http_types.request) outchan = +let callback ((req: Http_types.request), outchan) = try Http_getter_logger.log ("Connection from " ^ req#clientAddr); Http_getter_logger.log ("Received request: " ^ req#uri); @@ -334,6 +334,11 @@ let callback (req: Http_types.request) outchan = log_failure msg; return_html_error ("uncaught_exception", msg) msg outchan) +let callback req outchan = + HExtlib.finally + (fun () -> try close_out outchan with Sys_error _ -> ()) + callback (req, outchan) + let batch_update = ref false let args = [ ] -- 2.39.2