From 870c980d0502271eb5a3edcdeb8374365c9721c3 Mon Sep 17 00:00:00 2001 From: Sapan Bhatia Date: Tue, 24 Mar 2009 00:58:22 +0000 Subject: [PATCH] --- .dep | 2 ++ Makefile | 4 ++-- unixsocketwatcher.ml | 27 +++++++++++++-------------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.dep b/.dep index cfa40da..ed3cb74 100644 --- a/.dep +++ b/.dep @@ -20,3 +20,5 @@ main.cmo: inotify.cmi globals.cmo frontend.cmo fdwatcher.cmo dirwatcher.cmo \ directfifowatcher.cmo conffile.cmo backend.cmo main.cmx: inotify.cmi globals.cmx frontend.cmx fdwatcher.cmx dirwatcher.cmx \ directfifowatcher.cmx conffile.cmx backend.cmx +unixsocketwatcher.cmo: globals.cmo fdwatcher.cmo +unixsocketwatcher.cmx: globals.cmx fdwatcher.cmx diff --git a/Makefile b/Makefile index b5272ca..1f6d4d0 100644 --- a/Makefile +++ b/Makefile @@ -33,8 +33,8 @@ ocaml_inotify-0.4/inotify.cmxa: splice_stub.o: splice_stub.c gcc -c -I /usr/lib/ocaml -I /usr/lib64/ocaml splice_stub.c -o splice_stub.o -vsys: ocaml_inotify-0.4/inotify.cmxa globals.cmx fdwatcher.cmx conffile.cmx splice_stub.o splice.cmx dirwatcher.cmx fifowatcher.cmx frontend.cmx backend.cmx main.cmx docs - ocamlopt -I ocaml_inotify-0.4 str.cmxa unix.cmxa inotify.cmxa globals.cmx fdwatcher.cmx dirwatcher.cmx splice.cmx splice_stub.o directfifowatcher.cmx frontend.cmx backend.cmx str.cmxa conffile.cmx main.cmx -o vsys +vsys: ocaml_inotify-0.4/inotify.cmxa globals.cmx fdwatcher.cmx conffile.cmx splice_stub.o splice.cmx dirwatcher.cmx fifowatcher.cmx frontend.cmx unixsocketwatcher.cmx backend.cmx main.cmx docs + ocamlopt -I ocaml_inotify-0.4 str.cmxa unix.cmxa inotify.cmxa globals.cmx fdwatcher.cmx dirwatcher.cmx splice.cmx splice_stub.o directfifowatcher.cmx frontend.cmx unixsocketwatcher.cmx backend.cmx str.cmxa conffile.cmx main.cmx -o vsys vsys.b: ocaml_inotify-0.4/inotify.cma inotify.cmi globals.ml fdwatcher.ml dirwatcher.ml directfifowatcher.ml frontend.ml backend.ml main.ml ocamlc -g str.cma unix.cma ocaml_inotify-0.4/inotify.cma globals.cmo fdwatcher.cmo dirwatcher.cmo directfifowatcher.cmo frontend.cmo backend.cmo str.cma conffile.cmo main.cmo -o vsys.b diff --git a/unixsocketwatcher.ml b/unixsocketwatcher.ml index 32316e2..f997156 100644 --- a/unixsocketwatcher.ml +++ b/unixsocketwatcher.ml @@ -43,28 +43,27 @@ let mkentry fqp exec_fqp perm slice_name = e->logprint "Error creating FIFO: %s->%s. May be something wrong at the frontend.\n" fqp exec_fqp;Failed let receive_event (listening_socket_spec:fname_and_fd) (_:fname_and_fd) = - (* Do we care about this file? *) - try let (_,listening_socket) = listening_socket_spec in + try let (data_socket, addr) = accept listening_socket in match addr with | ADDR_UNIX(fname) -> - let entry_info = - try - Hashtbl.find unix_socket_table fname + begin + let entry_info = + try + Hashtbl.find unix_socket_table fname with _ -> None in - match entry_info with - begin - | Some(_,execpath,slice_name,fd) -> - begin + match entry_info with + | Some(execpath,slice_name,fd) -> + begin - end - | None -> () - end - | _ -> logprint "Serious error! Got a non UNIX connection over a UNIX socket\n" - with e-> logprint "Error connecting service %s\n" execpath + end + | None -> () + end + | _ -> logprint "Serious error! Got a non UNIX connection over a UNIX socket\n" + with e-> logprint "Error accepting socket\n" (** Close sockets that just got removed *) let closeentry fqp = -- 2.43.0