Unlock pool before leaving mutex through goto!
authorZdeněk Šustr <sustr4@cesnet.cz>
Wed, 4 Apr 2012 12:19:33 +0000 (12:19 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Wed, 4 Apr 2012 12:19:33 +0000 (12:19 +0000)
org.glite.lb.client/src/connection.c
org.glite.lb.client/src/prod_proto.c

index 0418e26..45ba4e7 100644 (file)
@@ -304,11 +304,15 @@ int edg_wll_open(edg_wll_Context ctx, int* connToUse)
        if ( (index = ConnectionIndex(ctx, ctx->srvName, ctx->srvPort)) == -1 ) {
                /* no such open connection in pool */
                if (ctx->connections->connOpened == ctx->connections->poolSize)
-                       if(ReleaseConnection(ctx, NULL, 0)) goto end;
+                       if(ReleaseConnection(ctx, NULL, 0)) {
+                               edg_wll_poolUnlock(); 
+                               goto end;
+                       }
                
                index = AddConnection(ctx, ctx->srvName, ctx->srvPort);
                if (index < 0) {
                     edg_wll_SetError(ctx,EAGAIN,"connection pool size exceeded");
+                   edg_wll_poolUnlock(); 
                    goto end;
                }
 
index 3d1a2ff..4bba21b 100644 (file)
@@ -249,11 +249,13 @@ int edg_wll_log_connect(edg_wll_Context ctx, int *conn)
                if (ctx->connections->connOpened == ctx->connections->poolSize)
                        if (ReleaseConnection(ctx, NULL, 0)) {
                                answer = edg_wll_SetError(ctx,EAGAIN,"cannot release connection (pool size exceeded)");
+                               edg_wll_poolUnlock();
                                goto edg_wll_log_connect_end;
                        }
                index = AddConnection(ctx, ctx->p_destination, ctx->p_dest_port);
                if (index < 0) {
                     answer = edg_wll_SetError(ctx,EAGAIN,"cannot add connection to pool");
+                   edg_wll_poolUnlock();
                    goto edg_wll_log_connect_end;
                }
 #ifdef EDG_WLL_LOG_STUB