From 0dec3cb8c59ba272b6b00fdd959ad9357f00b837 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 --- daemons/whelp/searchEngine.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/daemons/whelp/searchEngine.ml b/daemons/whelp/searchEngine.ml index e98bfe356..bb8c72297 100644 --- a/daemons/whelp/searchEngine.ml +++ b/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