- | Process(out_channel) ->
- let cont = ref true in
- while (!cont) do
- try
- fprintf logfd "Reading...\n";flush logfd;
- let curline = input_line inchan_fd in
- fprintf out_channel "%s\n" curline;flush out_channel
- with
- |End_of_file->
- (
- match (evfname,fname_other) with
- | Some(str1),Some(str2)->
- fprintf logfd "Reopening entry\n";flush logfd;
- reopenentry_int evfd str1 str2
- | Some(str1),None ->
- fprintf logfd "Bug, nameless pipe\n";flush logfd;raise Bug
- | None,_ ->
- fprintf logfd "Race condition -> user deleted file before closing it. Clever ploy, but won't work.\n";
- flush logfd
- );
- cont:=false
- |Sys_blocked_io ->fprintf logfd "Sysblockedio\n";flush logfd;
- cont:=false
- | Unix_error(_,s1,s2) -> fprintf logfd "Unix error %s - %s\n" s1 s2;flush logfd;cont:=false
- (*| _ ->fprintf logfd "Bug: unhandled exception\n";flush
- * logfd;raise Bug*)
- done;
+ | Process(fifo_outfd) ->
+ begin
+ try
+ printf "Received fifo event\n";flush Pervasives.stdout;
+ let tr0,tr1 = Unix.pipe() in
+ ignore(splice evfd tr1 4096);
+ ignore(splice tr0 fifo_outfd 4096)
+ with Failure(str) ->
+ begin
+ fprintf logfd "Error connecting user to service: %s\n" str;
+ flush logfd
+ end;