behave correctly when notifDrop comes and notif-Il not running
authorMiloš Mulač <mulac@civ.zcu.cz>
Wed, 27 Feb 2008 15:51:00 +0000 (15:51 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Wed, 27 Feb 2008 15:51:00 +0000 (15:51 +0000)
- consider ECONREFUSED as soft error on server side

org.glite.lb.server/src/bkserverd.c
org.glite.lb.server/src/notification.c
org.glite.lbjp-common.server-bones/src/srvbones.c

index 789f365..dee6b40 100644 (file)
@@ -1372,6 +1372,7 @@ int bk_accept_serve(int conn, struct timeval *timeout, void *cdata)
                        /*      fallthrough
                         */
                case ENOTCONN:
+               case ECONNREFUSED:
                        free(errt); free(errd);
                        /*
                         *      "recoverable" error - return (>0)
index 074260c..0e30a3b 100644 (file)
@@ -5,6 +5,8 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
+#include <syslog.h>
+#include <unistd.h>
 
 #include "glite/jobid/strmd5.h"
 #include "glite/lbu/trio.h"
@@ -407,6 +409,17 @@ int edg_wll_NotifDropServer(
                if ( edg_wll_ExecSQL(ctx, stmt, NULL) < 0 ) 
                        goto rollback;
                edg_wll_NotifCancelRegId(ctx, nid);
+               if (edg_wll_Error(ctx, NULL, NULL) == ECONNREFUSED) {
+                       /* Let notification erase from DB, 
+                        * on notif-IL side it will be autopurged later anyway */
+
+                       fprintf(stderr,"[%d] edg_wll_NotifDropServer() - NotifID found and dropped,"\
+                               " however, connection to notif-IL was refused (notif-IL not running?)\n", getpid());
+                       syslog(LOG_INFO,"edg_wll_NotifDropServer() - NotifID found and dropped,"\
+                               " however, connection to notif-IL was refused (notif-IL not running?)");
+
+                       edg_wll_ResetError(ctx);
+               }
 
 rollback:
                free(nid_s); nid_s = NULL;
index 3fcc41c..1807adb 100644 (file)
@@ -481,7 +481,8 @@ static int slave(slave_data_init_hnd data_init_hnd, int sock)
                                req_cnt++;
                                first_request = 0;
                                to = set_request_to;
-                               if ((rv = services[srv].on_request_hnd(conn,to.tv_sec>=0 ? &to : NULL,clnt_data)) == ENOTCONN) {
+                               rv = services[srv].on_request_hnd(conn,to.tv_sec>=0 ? &to : NULL,clnt_data);
+                               if ( (rv == ENOTCONN) || (rv == ECONNREFUSED) ) {
                                        if (services[srv].on_disconnect_hnd
                                                        && (rv = services[srv].on_disconnect_hnd(conn,NULL,clnt_data)))
                                        {