From beca28fee01e09addf163d00851cc195819e92ac Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Thu, 7 Jul 2005 11:42:53 +0000 Subject: [PATCH] prevent closing an already closed connection --- org.glite.lb.client/src/connection.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/org.glite.lb.client/src/connection.c b/org.glite.lb.client/src/connection.c index f7e666a..931a072 100644 --- a/org.glite.lb.client/src/connection.c +++ b/org.glite.lb.client/src/connection.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "glite/lb/consumer.h" #include "glite/lb/context-int.h" @@ -21,6 +22,9 @@ static void CloseConnection(edg_wll_Context ctx, int conn_index) /* close connection ad free its structures */ OM_uint32 min_stat; + assert(ctx->connOpened); + assert(conn_index < ctx->connOpened); + edg_wll_gss_close(&ctx->connPool[conn_index].gss, &ctx->p_tmp_timeout); if (ctx->connPool[conn_index].gsiCred) gss_release_cred(&min_stat, &ctx->connPool[conn_index].gsiCred); @@ -96,9 +100,11 @@ static void ReleaseConnection(edg_wll_Context ctx, char *name, int port) int edg_wll_close(edg_wll_Context ctx) { edg_wll_ResetError(ctx); + if (ctx->connToUse == -1) return 0; CloseConnection(ctx, ctx->connToUse); + ctx->connToUse = -1; return edg_wll_Error(ctx,NULL,NULL); } @@ -183,6 +189,7 @@ err: /* some error occured; close created connection * and free all fields in connPool[index] */ CloseConnection(ctx, index); + ctx->connToUse = -1; ok: return edg_wll_Error(ctx,NULL,NULL); } @@ -320,6 +327,7 @@ int edg_wll_http_send_recv( default: goto err; } + assert(ctx->connToUse >= 0); gettimeofday(&ctx->connPool[ctx->connToUse].lastUsed, NULL); return 0; -- 1.8.2.3