Race condition during context initializations.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Sun, 4 Mar 2012 20:43:12 +0000 (20:43 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Sun, 4 Mar 2012 20:43:12 +0000 (20:43 +0000)
org.glite.lb.client/src/connection.c
org.glite.lb.common/src/context.c
org.glite.lb.common/src/param.c

index 2b56382..0418e26 100644 (file)
@@ -716,7 +716,7 @@ int edg_wll_accept(edg_wll_Context ctx, int fd)
        }
 
         #ifdef EDG_WLL_CONNPOOL_DEBUG  
-               printf("Connection with fd %d accepted. %d in the pool\n",>srvName,ctx->srvPort,ctx->connNotif->connToUse);
+               printf("Connection with fd %d accepted. %d in the pool\n",ctx->srvName,ctx->srvPort,ctx->connNotif->connToUse);
         #endif
                
 
index c522e97..97f5e55 100644 (file)
@@ -53,15 +53,6 @@ int edg_wll_InitContext(edg_wll_Context *ctx)
        out->allowAnonymous = 1;
        out->notifSock  = -1;
 
-       memset(&null, 0, sizeof null);
-       for (i=0; i<EDG_WLL_PARAM__LAST; i++) {
-               if ((ret = edg_wll_SetParam(out,i,null)) != 0) {
-                       edg_wll_FreeParams(out);
-                       free(out);
-                       return ret;
-               }
-       }
-
        out->p_tmp_timeout.tv_sec = out->p_log_timeout.tv_sec;
        out->p_tmp_timeout.tv_usec = out->p_log_timeout.tv_usec;
 
@@ -73,6 +64,14 @@ int edg_wll_InitContext(edg_wll_Context *ctx)
        out->connProxy->conn.sock = -1;
 //     out->connToUse = -1;
 
+       memset(&null, 0, sizeof null);
+       for (i=0; i<EDG_WLL_PARAM__LAST; i++) {
+               if ((ret = edg_wll_SetParam(out,i,null)) != 0) {
+                       edg_wll_FreeContext(out);
+                       return ret;
+               }
+       }
+
        *ctx = out;
 
 #ifdef CTXTRACE
index 4b6ab39..2ebaf8b 100644 (file)
@@ -24,6 +24,7 @@ limitations under the License.
 
 #include "glite/jobid/cjobid.h"
 #include "context-int.h"
+#include "connpool.h"
 // XXX:
 #include "log_proto.h" // for default log host and port
 #include "timeouts.h" // for timeouts
@@ -260,7 +261,10 @@ int edg_wll_SetParamInt(edg_wll_Context ctx,edg_wll_ContextParam param,int val)
                                char *s = mygetenv(param);
                                
                                if (!val && s) val = atoi(s);
+
+                               edg_wll_poolLock();
                                connectionsHandle.poolSize = val ? val : GLITE_LB_COMMON_CONNPOOL_SIZE;
+                               edg_wll_poolUnlock();
                        }
                        break;
                case EDG_WLL_PARAM_SOURCE: