From mboxrd@z Thu Jan 1 00:00:00 1970 From: lhh@sourceware.org Date: 16 Aug 2006 15:01:38 -0000 Subject: [Cluster-devel] cluster/gulm/src lock_io.c ltpx_io.c Message-ID: <20060816150138.29451.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Branch: STABLE Changes by: lhh at sourceware.org 2006-08-16 15:01:37 Modified files: gulm/src : lock_io.c ltpx_io.c Log message: Port bugfix for 183507 from RHEL4 branch (Fix by cfeist) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gulm/src/lock_io.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.9.2.5.6.1&r2=1.9.2.5.6.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gulm/src/ltpx_io.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.12.2.1&r2=1.12.2.1.6.1 --- cluster/gulm/src/Attic/lock_io.c 2005/06/21 16:07:40 1.9.2.5.6.1 +++ cluster/gulm/src/Attic/lock_io.c 2006/08/16 15:01:37 1.9.2.5.6.2 @@ -515,6 +515,7 @@ uint64_t x_gen; uint32_t x_code, x_error, x_rank; uint8_t x_ama; + int connection_attempts = 0; if((cfd = socket(AF_INET6, SOCK_STREAM, 0)) <0) { log_err("Failed to create socket. %d:%s\n", errno, strerror(errno)); @@ -526,10 +527,19 @@ adr.sin6_addr = in6addr_loopback; adr.sin6_port = htons(gulm_config.corePort); - if( connect(cfd, (struct sockaddr*)&adr, sizeof(struct sockaddr_in6))<0) { + while ( connect(cfd, (struct sockaddr*)&adr, sizeof(struct sockaddr_in6))<0) { close(cfd); - log_err("Failed to connect to core. %d:%s\n", errno, strerror(errno)); - return -1; + + connection_attempts++; + if (connection_attempts > 3) { + log_err("Failed to connect to core, shutting down lock_gulmd_LT."); + return -1; + } + if (connection_attempts > 1) + log_err("Failed to connect to core. %d:%s\n", errno, strerror(errno)); + + sleep(5); + } idx = add_to_pollers(cfd, poll_Open, 0, "_ core _", &in6addr_loopback); --- cluster/gulm/src/Attic/ltpx_io.c 2005/02/07 15:25:31 1.12.2.1 +++ cluster/gulm/src/Attic/ltpx_io.c 2006/08/16 15:01:37 1.12.2.1.6.1 @@ -426,6 +426,7 @@ uint64_t x_gen; uint32_t x_code, x_error, x_rank; uint8_t x_ama; + int connection_attempts = 0; if((cfd = socket(AF_INET6, SOCK_STREAM, 0)) <0) { log_err("Failed to create socket. %d:%s\n", errno, strerror(errno)); @@ -437,10 +438,18 @@ adr.sin6_addr = in6addr_loopback; adr.sin6_port = htons(gulm_config.corePort); - if( connect(cfd, (struct sockaddr*)&adr, sizeof(struct sockaddr_in6))<0) { + while ( connect(cfd, (struct sockaddr*)&adr, sizeof(struct sockaddr_in6))<0) { close(cfd); - log_err("Failed to connect to core. %d:%s\n", errno, strerror(errno)); - return -1; + + connection_attempts++; + if (connection_attempts > 3) { + log_err("Failed to connect to core, shutting down lock_gulmd_LTPX."); + return -1; + } + if (connection_attempts > 1) + log_err("Failed to connect to core. %d:%s\n", errno, strerror(errno)); + + sleep(5); } idx = add_to_pollers(cfd, poll_Open, 0, "_ core _", &in6addr_loopback);