#include "glite/lb/context.h"
#include "glite/lb/xml_conversions.h"
+#include "glite/security/glite_gss.h"
#include "consumer.h"
int use_proxy = 0;
arguments.argv_0 = argv[0];
+ /* threads && Globus */
+ if (edg_wll_gss_initialize()) {
+ printf("can't initialize GSS\n");
+ return 1;
+ }
+
/* Do a thready work */
{
pthread_t threads[thr_num];
int ConnectionIndex(edg_wll_Context ctx, const char *name, int port);
int AddConnection(edg_wll_Context ctx, char *name, int port);
int ReleaseConnection(edg_wll_Context ctx, char *name, int port);
-int CloseConnection(edg_wll_Context ctx, int* conn_index);
+int CloseConnection(edg_wll_Context ctx, int conn_index);
#define PROXY_CONNECT_RETRY 10 /* ms */
#include "connection.h"
-int CloseConnection(edg_wll_Context ctx, int* conn_index)
-// XXX: should change the parameter conn_index to int (parameter is IN only)
+int CloseConnection(edg_wll_Context ctx, int conn_index)
{
/* close connection and free its structures */
int cIndex,ret = 0;
- cIndex = *conn_index;
+ cIndex = conn_index;
assert(ctx->connections->connOpened);
ctx->connections->connOpened--;
-// XXX: not needed *conn_index = cIndex;
-
return ret;
}
if (name) {
if ((index = ConnectionIndex(ctx, name, port)) >= 0)
- CloseConnection(ctx, &index);
+ CloseConnection(ctx, index);
}
else { /* free the oldest (unlocked) connection */
for (i=0; i<ctx->connections->poolSize; i++) {
}
}
if (!foundConnToDrop) return edg_wll_SetError(ctx,EAGAIN,"all connections in the connection pool are locked");
- CloseConnection(ctx, &index);
+ CloseConnection(ctx, index);
}
return edg_wll_Error(ctx,NULL,NULL);
}
edg_wll_ResetError(ctx);
if (*connToUse == -1) return 0;
- CloseConnection(ctx, connToUse);
+ CloseConnection(ctx, *connToUse);
edg_wll_connectionUnlock(ctx, *connToUse); /* Forgetting the conn. Unlocking is safe. */
err:
/* some error occured; close created connection
* and free all fields in connPool[index] */
- if (index >= 0) CloseConnection(ctx, &index);
+ if (index >= 0) {
+ CloseConnection(ctx, index);
+ edg_wll_connectionUnlock(ctx, index);
+ }
*connToUse = -1;
ok:
} else goto edg_wll_log_connect_end;
edg_wll_log_connect_err:
- if (index >= 0) CloseConnection(ctx, &index);
+ if (index >= 0) {
+ CloseConnection(ctx, index);
+ edg_wll_connectionUnlock(ctx, index);
+ }
index = -1;
edg_wll_log_connect_end:
int ret = 0;
if (conn == -1) return 0;
- ret = CloseConnection(ctx,&conn);
+ ret = CloseConnection(ctx,conn);
edg_wll_connectionUnlock(ctx,conn);
return ret;
}