From a72bdf47bf2ed2f00c7d3b5f1d53d0264d5efd7f Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Mon, 29 May 2006 17:10:14 +0000 Subject: [PATCH] ensure connections get closed after having been served --- daemons/rdfly/rdfly.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/daemons/rdfly/rdfly.ml b/daemons/rdfly/rdfly.ml index b9a79d139..18c2e1587 100644 --- a/daemons/rdfly/rdfly.ml +++ b/daemons/rdfly/rdfly.ml @@ -152,7 +152,7 @@ let password = get_option "rdfly.mysql_connection.password";; let user = get_option "rdfly.mysql_connection.user";; let daemonport = Helm_registry.get_int "rdfly.port";; -let callback (req: Http_types.request) ch = +let callback ((req: Http_types.request), ch) = try debug_print ("Connection from " ^ req#clientAddr) ; debug_print ("Received request: " ^ req#uri) ; @@ -180,6 +180,11 @@ let callback (req: Http_types.request) ch = | exc -> return_html_error ("Uncaught exception: " ^ (Printexc.to_string exc)) ch +let callback req ch = + HExtlib.finally + (fun () -> try close_out ch with Sys_error _ -> ()) + callback (req, ch) + let main () = Sys.catch_break true; try -- 2.39.2