X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=daemons%2Fgraphs%2Ftools%2FuriSetQueue.ml;h=9c94d4e9a18a4461a2f678fc59711238f8e7fbdb;hb=27a70cc8c150c426956005e95b432b3a34ff36c0;hp=43027580016fe58101457ccc8ae38398ff8f0e8c;hpb=8feb1cda5703daa4371c556593bab63514423a58;p=helm.git diff --git a/daemons/graphs/tools/uriSetQueue.ml b/daemons/graphs/tools/uriSetQueue.ml index 430275800..9c94d4e9a 100644 --- a/daemons/graphs/tools/uriSetQueue.ml +++ b/daemons/graphs/tools/uriSetQueue.ml @@ -76,7 +76,7 @@ let queue_mem item queue = (* mem function over queues *) with Found -> true ;; -let callback (req: Http_types.request) outchan = +let callback ((req: Http_types.request), outchan) = try let res = new Http_response.response () in res#addBasicHeaders; @@ -181,10 +181,18 @@ let callback (req: Http_types.request) outchan = outchan in +let callback req ch = + HExtlib.finally + (fun () -> try close_out ch with Sys_error _ -> ()) + callback (req, ch) + +in + Helm_registry.load_from configuration_file; let port = Helm_registry.get_int "uri_set_queue.port" in printf "%s started and listening on port %d\n" daemon_name port; flush stdout; -Http_daemon.start' ~port ~mode:`Thread callback; +let d_spec = Http_daemon.daemon_spec ~port ~mode:`Thread ~callback () in +Http_daemon.main d_spec; printf "%s is terminating, bye!\n" daemon_name