From: Zdeněk Šustr Date: Tue, 2 Feb 2010 15:45:13 +0000 (+0000) Subject: Fixes as per bug #37081 X-Git-Tag: merge_3795_branch_2_0_dst~6 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=31d750ee6cf68c09a776f49bc016c9739e017121;p=jra1mw.git Fixes as per bug #37081 - Locking the critial section in connPool initiation - Reducing portions of code carried out under overall pool lock --- diff --git a/org.glite.lb.client/src/connection.c b/org.glite.lb.client/src/connection.c index a8f8574..62cf7b3 100644 --- a/org.glite.lb.client/src/connection.c +++ b/org.glite.lb.client/src/connection.c @@ -305,6 +305,10 @@ int edg_wll_open(edg_wll_Context ctx, int* connToUse) #endif *connToUse = index; + + //Lock the select connection, unlock the rest of the pool + edg_wll_connectionTryLock(ctx, index); + edg_wll_poolUnlock(); /* Old Comment: support anonymous connections, perhaps add a flag to the connPool * struct specifying whether or not this connection shall be authenticated @@ -412,7 +416,9 @@ ok: end: - edg_wll_poolUnlock(); /* One way or the other, there are no more pool-wide operations */ +// edg_wll_poolUnlock(); /* One way or the other, there are no more pool-wide operations */ +// ZS, 2 Feb 2010: Overall pool lock replaced with a connection-specific +// lock for the most part // xxxxx diff --git a/org.glite.lb.client/src/prod_proto.c b/org.glite.lb.client/src/prod_proto.c index 90f6785..062d959 100644 --- a/org.glite.lb.client/src/prod_proto.c +++ b/org.glite.lb.client/src/prod_proto.c @@ -246,6 +246,10 @@ int edg_wll_log_connect(edg_wll_Context ctx, int *conn) ctx->connections->connPool[index].peerPort,index); #endif + // Unlock the pool here but lock the connection in question + edg_wll_connectionTryLock(ctx, index); + edg_wll_poolUnlock(); + #if 0 /* acquire gss credentials */ ret = edg_wll_gss_acquire_cred_gsi( @@ -324,7 +328,10 @@ edg_wll_log_connect_err: edg_wll_log_connect_end: if (index >= 0) edg_wll_connectionTryLock(ctx, index); - edg_wll_poolUnlock(); +// edg_wll_poolUnlock(); +// ZS, 2 Feb 2010: Overall pool lock replaced with a connection-specific +// lock for the most part + #ifdef EDG_WLL_LOG_STUB if (answer) { diff --git a/org.glite.lb.common/src/connpool.c b/org.glite.lb.common/src/connpool.c index 0f287a9..9091061 100644 --- a/org.glite.lb.common/src/connpool.c +++ b/org.glite.lb.common/src/connpool.c @@ -250,6 +250,8 @@ edg_wll_Connections* edg_wll_initConnections() { printf("Entering edg_wll_initConnections\n"); #endif + edg_wll_poolLock(); + if((connectionsHandle.connPool == NULL) && (connectionsHandle.poolSize > 0)) { /* We need to allocate memory for the connPool and connectionLock arrays */ @@ -277,6 +279,7 @@ edg_wll_Connections* edg_wll_initConnections() { connectionsHandle.serverConnection = (edg_wll_ConnPool *) calloc(1, sizeof(edg_wll_ConnPool)); } + edg_wll_poolUnlock(); return (&connectionsHandle); }