ftumsh has asked for the wisdom of the Perl Monks concerning the following question:
And here's the test client#! /usr/bin/perl -w use strict; use diagnostics; while (1) { print "HERE\n"; open FH, "<pipe"; my $data = <FH>; close FH; print "D: $data\n"; for ( split /ROSE/, $data ? $data : '' ) { if ( /^RELOAD/ ) { } else { sleep 3; } } } # while 1
Here's the live server code snippet:#! /usr/bin/perl -w use strict; use diagnostics; my $f = shift; for my $dir (1..20) { open (PIPE, ">pipe"); $dir = $f.'_'.$dir; $| = 1; select(PIPE); print STDOUT "$dir\n"; print PIPE "C,$dir,1ROSE"; close PIPE; sleep 1; }
and the live client code snippet:open FH, "<$config->{'pipe'}"; my $data = <FH>; close FH; Log( { logfile => $log_file, text => 'trace: START: '. ( $data || +'$data no val' ) }) if TRACE;
The logs show that the client "sent" a message at 08:40:20 and the server didn't get it ie it got one at 08:40:17 and another at 08:40:22 (the server log is GMT, client log BST) Here's a sample from the client log:if ( $has_files ) { my @now = gettimeofday; open FH, ">> /tmp/tmd_logs/DNOTIFY.LOG"; print FH format_time( $now[0] ).'.'.$now[1], " PREOPEN $dir\n"; close FH; open (PIPE, ">$pipe"); @now = gettimeofday; open FH, ">> /tmp/tmd_logs/DNOTIFY.LOG"; print FH format_time( $now[0] ).'.'.$now[1], " POSTOPEN $dir\n"; close FH; $| = 1; select(PIPE); eval { print PIPE "C,$dir,1ROSE"; }; $dirs{$dir}-- if $@; close PIPE; @now = gettimeofday; open FH, ">> /tmp/tmd_logs/DNOTIFY.LOG"; print FH format_time( $now[0] ).'.'.$now[1], " POSTCLOS $dir\n"; close FH; }
and here's the time snippet from the server log.08:40:20.96244 PREOPEN /other/hosting/LIVE/127/out/3_304_127_21 08:40:20.96460 POSTOPEN /other/hosting/LIVE/127/out/3_304_127_21 08:40:20.96570 POSTCLOS /other/hosting/LIVE/127/out/3_304_127_21 08:40:20.96690 S: 14:35:51 H: 1 A: 08:31:06 M: 08:40:19 C: 08:40:19 SI +G: 0 /other/hosting/LIVE/127/out/3_304_127_21 08:53:38.319388 PREOPEN /other/hosting/LIVE/127/out/3_304_127_21 08:53:38.319599 POSTOPEN /other/hosting/LIVE/127/out/3_304_127_21 08:53:38.319712 POSTCLOS /other/hosting/LIVE/127/out/3_304_127_21 08:53:38.319834 S: 08:40:19 H: 1 A: 08:53:32 M: 08:53:36 C: 08:53:36 S +IG: 0 /other/hosting/LIVE/127/out/3_304_127_21 08:53:40.359719 S: 08:53:36 H: 0 A: 08:53:38 M: 08:53:38 C: 08:53:38 S +IG: 0 /other/hosting/LIVE/127/out/3_304_127_21
080411 07:40:17.514797 [8625] trace: START: C,/other/hosting/toxml/LIV +E/273/out/1_128_1,1ROSE 080411 07:40:22.248450 [8625] trace: START: C,/other/hosting/LIVE/251/ +out/3_128_251_3,1ROSE
|
|---|