All pastes #465643 Raw Edit

pjc

public text v1 · immutable
#465643 ·published 2007-04-30 13:55 UTC
rendered paste body
Index: connection.cc
===================================================================
RCS file: /cvsroot/linux-decnet/dnprogs/libdap/connection.cc,v
retrieving revision 1.8
diff -u -p -r1.8 connection.cc
--- connection.cc	2 Feb 2006 10:52:41 -0000	1.8
+++ connection.cc	30 Apr 2007 13:55:30 -0000
@@ -278,9 +278,11 @@ bool dap_connection::do_connect(const ch
 	return false;
     }
 
+    alarm(60);
     if (::connect(sockfd, (struct sockaddr *)&s,
 		  sizeof(sockaddr)) < 0)
     {
+	alarm(0);
 	if (errno == ECONNREFUSED)
 	{
 	    sprintf(errstring, "connect failed: %s", connerror(strerror(errno)));
@@ -292,6 +294,7 @@ bool dap_connection::do_connect(const ch
 	lasterror = errstring;
 	return false;
     }
+    alarm(0);
 
 // Make sure we get a blocking socket to start with
     int flags = fcntl(sockfd, F_GETFL, 0);