From 320a00650a4503c11daa27d8faaf6c78361eb39b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ji=C5=99=C3=AD=20=C5=A0kr=C3=A1bal?= Date: Thu, 2 Dec 2004 11:29:06 +0000 Subject: [PATCH] - fixed errors in LB proxy communication protocol --- org.glite.lb.common/interface/context-int.h | 2 +- org.glite.lb.common/src/context.c | 11 ++++------- org.glite.lb.common/src/lb_plain_io.c | 1 + org.glite.lb.common/src/mini_http.c | 5 ++++- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/org.glite.lb.common/interface/context-int.h b/org.glite.lb.common/interface/context-int.h index c8125cb..0a28db5 100644 --- a/org.glite.lb.common/interface/context-int.h +++ b/org.glite.lb.common/interface/context-int.h @@ -36,7 +36,6 @@ typedef struct _edg_wll_ConnPool { /* http(s) stream */ gss_cred_id_t gsiCred; edg_wll_GssConnection gss; - edg_wll_Connection conn; /* for plain (non-gss) connections - i.e. lbproxy */ char *buf; int bufUse,bufSize; @@ -56,6 +55,7 @@ struct _edg_wll_Context { void *mysql; edg_wll_ConnPool *connPool; edg_wll_ConnPool *connPoolNotif; /* hold _one_ connection from notif-interlogger */ + edg_wll_Connection *connPlain; /* holds one plain connection */ int semaphores,semset; diff --git a/org.glite.lb.common/src/context.c b/org.glite.lb.common/src/context.c index 504022d..73d5372 100644 --- a/org.glite.lb.common/src/context.c +++ b/org.glite.lb.common/src/context.c @@ -51,10 +51,6 @@ void edg_wll_FreeContext(edg_wll_Context ctx) for (i=0; ipoolSize; i++) { if (ctx->connPool[i].peerName) free(ctx->connPool[i].peerName); - - close(ctx->connPool[i].conn.sock); - if (ctx->connPool[i].conn.buf) free(ctx->connPool[i].conn.buf); - edg_wll_gss_close(&ctx->connPool[i].gss,&close_timeout); if (ctx->connPool[i].gsiCred) gss_release_cred(&min_stat, &ctx->connPool[i].gsiCred); @@ -62,9 +58,10 @@ void edg_wll_FreeContext(edg_wll_Context ctx) } free(ctx->connPool); } - if (ctx->connPlain) { - if (ctx->connPlain->buf) free(ctx->connPlain->buf); - free(ctx->connPlain); + if ( ctx->connPlain ) { + if ( ctx->connPlain->buf ) free(ctx->connPlain->buf); + close(ctx->connPlain->sock); + free(ctx->connPlain); } if (ctx->notifSock >=0) close(ctx->notifSock); if (ctx->srvName) free(ctx->srvName); diff --git a/org.glite.lb.common/src/lb_plain_io.c b/org.glite.lb.common/src/lb_plain_io.c index dba91c6..d105ec2 100644 --- a/org.glite.lb.common/src/lb_plain_io.c +++ b/org.glite.lb.common/src/lb_plain_io.c @@ -51,6 +51,7 @@ int edg_wll_plain_accept( if ( (conn->sock = accept(sock, (struct sockaddr *)&a, &alen)) ) return -1; */ + conn->sock = sock; return 0; } diff --git a/org.glite.lb.common/src/mini_http.c b/org.glite.lb.common/src/mini_http.c index 99282be..87f71d4 100644 --- a/org.glite.lb.common/src/mini_http.c +++ b/org.glite.lb.common/src/mini_http.c @@ -171,7 +171,10 @@ edg_wll_ErrorCode edg_wll_http_recv_proxy(edg_wll_Context ctx,char **firstOut,ch ctx->connPlain->buf+ctx->connPlain->bufUse, ctx->connPlain->bufSize-ctx->connPlain->bufUse, &ctx->p_tmp_timeout); - if ( len < 0 ) goto error; + if ( len < 0 ) { + edg_wll_SetError(ctx, errno, "edg_wll_plain_read()"); + goto error; + } ctx->connPlain->bufUse += len; rdmore = 0; -- 1.8.2.3