X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Focaml-http%2Fhttp_daemon.ml;h=629d1286cfd7ea97be793e28bb01b8b891591455;hb=4167cea65ca58897d1a3dbb81ff95de5074700cc;hp=60f186cd43c509309c2e3c638b62e5a638f69e4e;hpb=a25dc2ceb44a9f0acf6e2d7fc9e18ab316fe3b15;p=helm.git diff --git a/helm/DEVEL/ocaml-http/http_daemon.ml b/helm/DEVEL/ocaml-http/http_daemon.ml index 60f186cd4..629d1286c 100644 --- a/helm/DEVEL/ocaml-http/http_daemon.ml +++ b/helm/DEVEL/ocaml-http/http_daemon.ml @@ -26,6 +26,8 @@ open Http_types open Http_constants open Http_parser +exception Http_daemon_failure of string + (** send raw data on outchan, flushing it afterwards *) let send_raw ~data outchan = output_string outchan data; @@ -408,13 +410,13 @@ module Trivial = let main spec = main { spec with callback = trivial_callback } end - (* @param inchan input channel connected to client + (** @param inchan input channel connected to client @param outchan output channel connected to client @param sockaddr client socket address *) class connection inchan outchan sockaddr = (* ASSUMPTION: inchan and outchan are channels built on top of the same Unix.file_descr thus closing one of them will close also the other *) - let close' o = o#close in + let close' o = try o#close with Http_daemon_failure _ -> () in object (self) initializer Gc.finalise close' self @@ -423,7 +425,8 @@ class connection inchan outchan sockaddr = method private assertNotClosed = if closed then - failwith "Http_daemon.connection: connection is closed" + raise (Http_daemon_failure + "Http_daemon.connection: connection is closed") method getRequest = self#assertNotClosed;