handle full pool
authorAleš Křenek <ljocha@ics.muni.cz>
Thu, 28 Sep 2006 16:56:43 +0000 (16:56 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Thu, 28 Sep 2006 16:56:43 +0000 (16:56 +0000)
org.glite.lb.client/examples/user_jobs_threaded.c
org.glite.lb.client/src/connection.c

index 47e0b05..65b2841 100644 (file)
@@ -7,6 +7,7 @@
 #include <expat.h>
 
 #include <pthread.h>
+#include <globus_common.h>
 
 #include "glite/lb/context.h"
 #include "glite/lb/xml_conversions.h"
@@ -119,6 +120,11 @@ int main(int argc,char **argv)
         pthread_t threads[NUM_THREADS];
        pthread_attr_t attr;
 
+       if (globus_module_activate(GLOBUS_COMMON_MODULE) != GLOBUS_SUCCESS)   {
+               fputs("globus_module_activate()\n",stderr);
+               return 1;
+       }
+
         pthread_attr_init(&attr);
         pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 
index a40210b..17a7560 100644 (file)
@@ -185,6 +185,8 @@ int edg_wll_open(edg_wll_Context ctx, int* connToUse)
                        ReleaseConnection(ctx, NULL, 0);
                
                index = AddConnection(ctx, ctx->srvName, ctx->srvPort);
+               if (index < 0) return edg_wll_SetError(ctx,EAGAIN,"connection pool size exceeded");
+
                 #ifdef EDG_WLL_CONNPOOL_DEBUG  
                     printf("Connection to %s:%d opened as No. %d in the pool\n",ctx->srvName,ctx->srvPort,index);
                 #endif