Use splice/tee to connect vsys clients and servers.
[vsys.git] / frontend.ml
index aca8e7b..ab4f176 100644 (file)
@@ -21,7 +21,7 @@ object(this)
             let realperm = perm land (lnot 0o111) in
     match rp with Relpath(rel) ->
       let fqp = String.concat "/" [root_dir;rel] in
-      let res = Fifowatcher.mkentry fqp abspath realperm in
+      let res = Fifowatcher.mkentry fqp abspath realperm slice_name in
         match res with 
           | Success ->
               Fifowatcher.openentry fqp (abspath,slice_name) realperm
@@ -41,8 +41,8 @@ object(this)
                 end
               else if (s.st_perm <> perm) then
                 begin
-                        printf "Removing directory %s\n" fqp;
-                        flush Pervasives.stdout;
+                        fprintf logfd "Removing directory %s\n" fqp;
+                        flush logfd;
                         Unix.rmdir fqp;
                         Unix.mkdir fqp perm
                 end
@@ -54,13 +54,15 @@ object(this)
   (** *)
   method unlink rp =
     match rp with Relpath(rel) ->
-    let fqp1 = String.concat "/" [root_dir;rel;".in"] in
-    let fqp2 = String.concat "/" [root_dir;rel;".out"] in
+    let fqp1 = String.concat "/" [root_dir;rel] in
+    let fqp_in = String.concat "." [fqp1;"in"] in
+    let fqp2 = String.concat "/" [root_dir;rel] in
+    let fqp_out = String.concat "." [fqp2;"out"] in
       try 
-        Unix.unlink fqp1;
-        Unix.unlink fqp2
+        Unix.unlink fqp_in;
+        Unix.unlink fqp_out
       with _ ->
-        printf "Hm. %s disappeared. Looks like slice %s shot itself in the foot\n" fqp1 (this#get_slice_name ());flush Pervasives.stdout
+        fprintf logfd "Hm. %s disappeared. Looks like slice %s shot itself in the foot\n" fqp1 (this#get_slice_name ());flush logfd
 
   method rmdir rp =
     match rp with Relpath(rel) ->
@@ -68,5 +70,5 @@ object(this)
       try
       Unix.rmdir fqp
       with _ ->
-        printf "Hm. %s disappeared. Looks like slice %s shot itself in the foot\n" fqp (this#get_slice_name ());flush Pervasives.stdout
+        fprintf logfd "Hm. %s disappeared. Looks like slice %s shot itself in the foot\n" fqp (this#get_slice_name ());flush logfd
 end