perl 5.8.8 syslog tests failing on MacOS X (sometimes)

Mark Blackman mark at blackmans.org
Fri Dec 15 20:00:50 GMT 2006


looking more closely at the code, probably more appropriate to change  
the timeout
in the select on line 963 from zero to something small, but useful  
like 0.25 or so.
Sébastien is better placed to decide exactly how much I suppose.

     959 sub connection_ok {
     960     return 1 if (defined $current_proto && $current_proto eq  
'console');
     961     my $rin = '';
     962     vec($rin, fileno(SYSLOG), 1) = 1;
     963     my $ret = select $rin, undef, $rin, 0.25;
     964     return ($ret ? 0 : 1);
     965 }

Cheers,
Mark


On 15 Dec 2006, at 18:10, Edmund von der Burg wrote:

> I changed the code to this as suggested by Mark:
>
>    # We want to check that the UDP connect worked. However the only
>    # way to do that is to send a message and see if an ICMP is  
> returned
>    _syslog_send_socket("");
>
>    warn "sleeping";
>    sleep 1;
>
>    if (!connection_ok()) {
> 	push(@{$errs}, "udp connect: nobody listening");
> 	return 0;
>    }
>
>
> and it now works fine. It does appear that our machines are too fast -
> mine is a MacBookPro dual 1.8GHz.
>
> Obviously one second is too long to sleep, and it should not have the
> warning there. I'll leave it to wiser heads to determine what it
> should be but am happy to test anything if that helps. Pehaps the
> sleep should be added only if it fails - that way it will not slow
> down the golden path....
>
> Cheers,
>  Edmund.
>
>
> -- 
> In reality I'm evdb at ecclestoad.co.uk - http://ecclestoad.co.uk




More information about the london.pm mailing list