]> git.etc.gen.nz Git - spong.git/commitdiff
added __DIE__ handler to reset alarm(0) if socket can't connect due to
authorStephen L Johnson <sjohnson@monsters.org>
Mon, 10 Jun 2002 20:34:58 +0000 (20:34 +0000)
committerStephen L Johnson <sjohnson@monsters.org>
Mon, 10 Jun 2002 20:34:58 +0000 (20:34 +0000)
explicit network error

src/spong-network.pl

index d237636820ddf93dd679cbe99ca3a6ab4646f1c3..90afa19dc6ad73596f3f9481d814b61caf1b465c 100755 (executable)
@@ -17,7 +17,7 @@
 # (2) Converted checks to new plugin mechanism (Stephen Johnson May 28, 1999)
 #     Added user-configurable escalation mechanism
 #
-# $Id: spong-network.pl,v 1.42 2002/06/10 20:33:09 sljohnson Exp $
+# $Id: spong-network.pl,v 1.43 2002/06/10 20:34:58 sljohnson Exp $
 
 use Carp;
 use lib "@@LIBDIR@@";
@@ -366,6 +366,7 @@ sub check_tcp {
    
    eval {
       local $SIG{'ALRM'} = sub { die "Socket timed out"; };
+      local $SIG{'__DIE__'} = sub { alarm(0); };  # Reset the alarm when dead
       alarm($timeout);
 
       socket( SOCK, PF_INET, SOCK_STREAM, $proto ) || die "socket: $!";