Skip to contentSkip to conversation

cluster/gulm/src lock_io.c ltpx_io.c

Cluster-devel [email protected] 1 participant 1 message Aug 16, 2006

lore
Share & tools
lore
#0 lore raw

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

gulm/src/Attic/lock_io.c +13 -3
@@ -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);
gulm/src/Attic/ltpx_io.c +12 -3
@@ -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);