From: Luca Padovani Date: Tue, 30 Jan 2001 14:39:03 +0000 (+0000) Subject: xsltProcessor.ml : patched to work with UWOBO X-Git-Tag: v0_1_2~158 X-Git-Url: http://matita.cs.unibo.it/gitweb/?p=helm.git;a=commitdiff_plain;h=f25a6ef4d3e7263420d1e72daccf5e60c672b47b xsltProcessor.ml : patched to work with UWOBO --- diff --git a/helm/interface/xsltProcessor.ml b/helm/interface/xsltProcessor.ml index b0ce618c3..9165a5363 100644 --- a/helm/interface/xsltProcessor.ml +++ b/helm/interface/xsltProcessor.ml @@ -48,36 +48,32 @@ let rec process uri usecache mode = (* purge the cache if asked to *) if not usecache && tmp_file_exists then Sys.remove tmpfile ; - let string_to_send = mode ^ " " ^ url ^ " " ^ tmpfile in + (* let string_to_send = mode ^ " " ^ url ^ " " ^ tmpfile in *) + let string_to_send = "apply " ^ url ^ " " ^ tmpfile ^ + match mode with + "cic" -> " C1 C2" + | "theory" -> " T1 T2" + in (* next function is for looping in case the server is not responding *) - let rec contact_server () = - let socketclient = U.socket U.PF_INET U.SOCK_DGRAM 0 - and socketserver = U.socket U.PF_INET U.SOCK_DGRAM 0 in - let bounded = ref false in - while not !bounded do - try - U.bind socketclient (U.ADDR_INET(U.inet_addr_any,portclient)) ; - bounded := true - with _ -> - print_endline "Port unavailable. Retrying..." ; flush stdout ; - U.sleep 5 (* wait hoping the inetaddr is released *) - done ; + let socketserver = U.socket U.PF_INET U.SOCK_DGRAM 0 in + let rec contact_server () = let n = + Printf.printf "sending %s to server...\n" string_to_send; + flush stdout; U.sendto socketserver string_to_send 0 (String.length string_to_send) [] (U.ADDR_INET(U.inet_addr_any,portserver)) in if n = -1 then raise XsltProcessorCouldNotSend ; - U.close socketserver ; - let process_signal _ = U.close socketclient in + let process_signal _ = () in Sys.set_signal Sys.sigalrm (Sys.Signal_handle process_signal) ; (* if the server does not respond, repeat the query *) ignore (U.alarm time_to_wait) ; try - if U.recv socketclient "" 0 0 [] = -1 then + if U.recv socketserver "" 0 0 [] = -1 then raise XsltProcessorCouldNotReceive ; ignore (U.alarm 0) ; (* stop the bomb *) Sys.set_signal Sys.sigalrm Sys.Signal_default ; - U.close socketclient ; + U.close socketserver ; tmpfile with U.Unix_error(_,"recv",_) -> @@ -85,5 +81,5 @@ let rec process uri usecache mode = flush stdout; contact_server () in - contact_server () + contact_server () ;;