- fixed errors in LB proxy communication protocol
authorJiří Škrábal <nykolas@ics.muni.cz>
Thu, 2 Dec 2004 11:29:06 +0000 (11:29 +0000)
committerJiří Škrábal <nykolas@ics.muni.cz>
Thu, 2 Dec 2004 11:29:06 +0000 (11:29 +0000)
org.glite.lb.common/interface/context-int.h
org.glite.lb.common/src/context.c
org.glite.lb.common/src/lb_plain_io.c
org.glite.lb.common/src/mini_http.c

index c8125cb..0a28db5 100644 (file)
@@ -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;
index 504022d..73d5372 100644 (file)
@@ -51,10 +51,6 @@ void edg_wll_FreeContext(edg_wll_Context ctx)
                
                for (i=0; i<ctx->poolSize; 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);
index dba91c6..d105ec2 100644 (file)
@@ -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;
 }
 
index 99282be..87f71d4 100644 (file)
@@ -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;