Blame SOURCES/xinetd-2.3.14-retry-svc-activate-in-cps-restart.patch

319196
diff -Napur xinetd-2.3.14.old/xinetd/access.c xinetd-2.3.14.new/xinetd/access.c
319196
--- xinetd-2.3.14.old/xinetd/access.c	2005-10-05 10:15:33.000000000 -0700
319196
+++ xinetd-2.3.14.new/xinetd/access.c	2012-02-22 20:12:09.120973124 -0800
319196
@@ -89,9 +89,20 @@ static void cps_service_restart(void)
319196
                msg(LOG_ERR, func,
319196
                "Activating service %s", SC_NAME(scp));
319196
             } else {
319196
-               msg(LOG_ERR, func,
319196
-               "Error activating service %s", 
319196
-               SC_NAME(scp)) ;
319196
+               /* Try to restart the service */
319196
+               SVC_ATTEMPTS(sp) += 1;
319196
+               if ( SVC_ATTEMPTS(sp) < MAX_SVC_ATTEMPTS ) {
319196
+                  msg(LOG_ERR, func, 
319196
+                  "Error activating service %s, retrying %d more time(s)...",
319196
+                  SC_NAME(scp),
319196
+                  MAX_SVC_ATTEMPTS - SVC_ATTEMPTS(sp));
319196
+                  xtimer_add(cps_service_restart, 1);
319196
+               } else {
319196
+                  /* Give up */
319196
+                  msg(LOG_ERR, func,
319196
+                  "Error activating service %s", 
319196
+                  SC_NAME(scp));
319196
+               } 
319196
             } /* else */
319196
          }
319196
       }
319196
diff -Napur xinetd-2.3.14.old/xinetd/service.c xinetd-2.3.14.new/xinetd/service.c
319196
--- xinetd-2.3.14.old/xinetd/service.c	2012-02-22 19:16:56.288912783 -0800
319196
+++ xinetd-2.3.14.new/xinetd/service.c	2012-02-22 19:25:03.059356909 -0800
319196
@@ -397,6 +408,7 @@ status_e svc_activate( struct service *s
319196
     * Initialize the service data
319196
     */
319196
    SVC_RUNNING_SERVERS(sp)   = SVC_RETRIES(sp) = 0 ;
319196
+   SVC_ATTEMPTS(sp) = 0;
319196
 
319196
    if ( SC_MUST_LISTEN( scp ) )
319196
       (void) listen( SVC_FD(sp), LISTEN_BACKLOG ) ;
319196
diff -Napur xinetd-2.3.14.old/xinetd/xconfig.h xinetd-2.3.14.new/xinetd/xconfig.h
319196
--- xinetd-2.3.14.old/xinetd/xconfig.h	2003-02-19 09:29:28.000000000 -0800
319196
+++ xinetd-2.3.14.new/xinetd/xconfig.h	2012-02-22 19:20:20.360855514 -0800
319196
@@ -59,6 +59,12 @@
319196
 #define DEFAULT_LOOP_TIME			10
319196
 
319196
 /*
319196
+ * The number of times to attempt re-activating a service after being
319196
+ * deactivated due to the above.
319196
+ */
319196
+#define MAX_SVC_ATTEMPTS                         30
319196
+
319196
+/*
319196
  * Signal-to-action mapping
319196
  */
319196
 #ifndef RECONFIG_HARD_SIG