Code

Restored old favor but without Reset Event.
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 31 Mar 2008 13:26:48 +0000 (13:26 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 31 Mar 2008 13:26:48 +0000 (13:26 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10092 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-client

index 55c31b42583cc35de5570401669080e93db5c39a..4ce9ceb4c57e283a177826393da0ead47a46cdf4 100755 (executable)
@@ -992,18 +992,18 @@ sub trigger_logged_in_users_report {
 #    return;
 #}
 
-#sub generic_file_error {
-#    my ( $heap, $operation, $errno, $error_string, $wheel_id ) =
-#      @_[ HEAP, ARG0, ARG1, ARG2, ARG3 ];
-#
-#    my $service = $heap->{services}->{$wheel_id};
-#    daemon_log("ERROR: '$service' watcher $operation error $errno: $error_string", 1);
-#    daemon_log("ERROR: shutting down '$service' file watcher", 1);
-#
-#    delete $heap->{services}->{$wheel_id};
-#    delete $heap->{watchers}->{$wheel_id};
-#    return;
-#}
+sub generic_file_error {
+    my ( $heap, $operation, $errno, $error_string, $wheel_id ) =
+      @_[ HEAP, ARG0, ARG1, ARG2, ARG3 ];
+
+    my $service = $heap->{services}->{$wheel_id};
+    daemon_log("ERROR: '$service' watcher $operation error $errno: $error_string", 1);
+    daemon_log("ERROR: shutting down '$service' file watcher", 1);
+
+    delete $heap->{services}->{$wheel_id};
+    delete $heap->{watchers}->{$wheel_id};
+    return;
+}
 
 
 sub fifo_got_record {
@@ -1084,19 +1084,19 @@ sub _start {
     $kernel->yield('register_at_gosa_si_server');
     
     # install all file watcher defined
-    while( my($file_name, $file) = each %files_to_watch ) {
-        #my $file_watcher = POE::Wheel::FollowTail->new(
-        #    Filename   => $file,
-        #    InputEvent => $file_name."_record",
+    while( my($name, $file) = each %files_to_watch ) {
+        my $watcher = POE::Wheel::FollowTail->new(
+            Filename   => $file,
+            InputEvent => $name."_record",
         #    ResetEvent => "file_reset",
-        #    ErrorEvent => "file_error",
-        #    );
-       $heap->{tail} = POE::Wheel::Run->new(
-               Program     => [ "/usr/bin/tail", "-f", $file ],
-               StdoutEvent => $file_name."_record",
-       );
-        #$heap->{services}->{ $file_watcher->ID } = $file_name;
-        #$heap->{watchers}->{ $file_watcher->ID } = $file_watcher;
+            ErrorEvent => "file_error",
+            );
+#      $heap->{tail} = POE::Wheel::Run->new(
+#              Program     => [ "/usr/bin/tail", "-f", $file ],
+#              StdoutEvent => $file_name."_record",
+#      );
+        $heap->{services}->{ $watcher->ID } = $name;
+        $heap->{watchers}->{ $watcher->ID } = $watcher;
     }
     $kernel->yield('trigger_logged_in_users_report'); 
 }