From 8802f9da75b49a95a1b695504c1b5178bce4d3e3 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Mon, 29 May 2006 17:36:36 +0000 Subject: [PATCH] ensure connections get closed after having been served --- helm/software/daemons/whelp/searchEngine.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/helm/software/daemons/whelp/searchEngine.ml b/helm/software/daemons/whelp/searchEngine.ml index e98bfe356..bb8c72297 100644 --- a/helm/software/daemons/whelp/searchEngine.ml +++ b/helm/software/daemons/whelp/searchEngine.ml @@ -404,7 +404,7 @@ prerr_endline "VIVO"; ^ " type"))) req outchan -let callback dbd (req: Http_types.request) outchan = +let callback (dbd, (req: Http_types.request), outchan) = try debug_print (sprintf "Received request: %s" req#path); (match req#path with @@ -482,6 +482,11 @@ let callback dbd (req: Http_types.request) outchan = let msg = MooglePp.pp_error "Uncaught exception" exn_string in send_results (`Error msg) req outchan +let callback dbd req ch = + HExtlib.finally + (fun () -> try close_out ch with Sys_error _ -> ()) + callback (dbd, req, ch) + let restore_environment () = match Helm_registry.get_opt Helm_registry.string "search_engine.environment_dump" -- 2.39.2