On Tue, Sep 20, 2005 at 05:40:24PM +0100, Graham David Purcocks M.A.(Oxon.)
wrote:
> Yes. It's Ultramonkey V3.
>
> Surprising if the CVS is worse than that :(
>
> The fact it uses $sock rather then $result means its different code.
>
> Ah. Whats your ld_open_socket look like. Maybe the check is in there.
> See the close is within ld_open_socket in my older version but you have
> a close outside.
>
> $result = connect(SOCK, $paddr);
> close(SOCK) || die "close: $!" if ($result);
> return $result;
> }
It seems that this was a regression added when I put the SIP
check into CVS, which incolved reworking ld_open_socket a little bit.
I have put the following fix into CVS as 1.121/1.77.2.32
--
Horms
Index: ldirectord
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord,v
retrieving revision 1.120
diff -u -r1.120 ldirectord
--- ldirectord 7 Sep 2005 07:31:23 -0000 1.120
+++ ldirectord 21 Sep 2005 03:59:19 -0000
@@ -1995,11 +1995,11 @@
local $SIG{'ALRM'} = sub { die "Timeout Alarm" };
&ld_debug(4, "Timeout is $$v{checktimeout}");
alarm $$v{checktimeout};
- # N.B: ld_open_socket dies on error, which
- # will throw us out of the eval
my $sock = &ld_open_socket($$r{server}, $port, $$v{protocol});
if ($sock) {
close($sock);
+ } else {
+ die(); #socket attempt failed immediately (not timeout)
}
&ld_debug(3, "Connected to $1 (port $port)");
alarm 0; # Cancel the alarm
@@ -2032,10 +2032,11 @@
&ld_debug(4, "Timeout is $$v{checktimeout}");
alarm $$v{checktimeout};
- # N.B: ld_open_socket dies on error, which
- # will throw us out of the eval
my $sock = &ld_open_socket($$r{server}, $sip_d_port,
$$v{protocol});
+ unless ($sock) {
+ die(); #socket attempt failed immediately (not timeout)
+ }
my $sip_sockaddr = getsockname($sock);
my ($sip_s_port, $sip_s_addr) = sockaddr_in($sip_sockaddr);
@@ -3094,7 +3095,7 @@
# protocol: Prococol to use. Should be either "tcp" or "udp"
# post: A Socket connection is opened to the remote host
# return: Open socket
-# Programe dies on error (may be caught by calling function)
+# undef on error
sub ld_open_socket
{
|