]> matita.cs.unibo.it Git - helm.git/blobdiff - daemons/whelp/searchEngine.ml
Instead of closing the socket to avoid persistent connections (a bugged
[helm.git] / daemons / whelp / searchEngine.ml
index fc49116196d4cb96ff0518d43527e76ab27ef753..8524588ca76ea9b4c557ca266242c2ed98f6a390 100644 (file)
@@ -403,7 +403,7 @@ let exec_action dbd (req: Http_types.request) outchan =
          ^ " 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
@@ -481,11 +481,6 @@ 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"
@@ -519,7 +514,7 @@ let _ =
   in
   restore_environment ();
   read_notation ();
-  let d_spec = Http_daemon.daemon_spec ~port ~callback:(callback dbd) () in
+  let d_spec = Http_daemon.daemon_spec ~port ~callback:(callback dbd) ~auto_close:true () in
   Http_daemon.main d_spec;
   printf "%s is terminating, bye!\n" daemon_name