]> matita.cs.unibo.it Git - helm.git/commitdiff
ensure connections get closed after having been served
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Mon, 29 May 2006 17:13:03 +0000 (17:13 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Mon, 29 May 2006 17:13:03 +0000 (17:13 +0000)
helm/software/daemons/proofChecker/proofChecker.ml

index e4f00fe3acf86c989b4e250af89000fda4942206..c4a6391ccb0a8138c54ba2e677a31b12e31e0a66 100644 (file)
@@ -92,7 +92,7 @@ let _ =
     flush !outchan)
 ;;
 
-let callback (req : Http_types.request) outchan' =
+let callback ((req : Http_types.request), outchan') =
   match req#path with
   | "/proofCheck" ->
       begin
@@ -125,6 +125,13 @@ let callback (req : Http_types.request) outchan' =
 
 in
 
+let callback req ch =
+  HExtlib.finally
+    (fun () -> try close_out ch with Sys_error _ -> ())
+    callback (req, ch)
+
+in
+
 printf "Proof Checker started and listening on port %d\n" port;
 flush stdout;
 CicEnvironment.set_trust (fun _ -> false);