- edg_wll_QuerySequenceCodeProxy() call tuning
authorJiří Škrábal <nykolas@ics.muni.cz>
Thu, 2 Dec 2004 11:27:58 +0000 (11:27 +0000)
committerJiří Škrábal <nykolas@ics.muni.cz>
Thu, 2 Dec 2004 11:27:58 +0000 (11:27 +0000)
- query_ext example (uses LB Proxy also)
- initialize memmory in producer call

org.glite.lb.client/Makefile
org.glite.lb.client/examples/consumer_fake.c
org.glite.lb.client/src/connection.c
org.glite.lb.client/src/consumer.c
org.glite.lb.client/src/producer.c

index 0913f24..d0b8711 100644 (file)
@@ -135,7 +135,7 @@ PLUSLIB:=libglite_lb_clientpp_${nothrflavour}.la
 THRPLUSLIB:=libglite_lb_clientpp_${thrflavour}.la
 
 TOOLS:=dump load purge
-EXAMPLES:=log_usertag_proxy job_reg feed_shark notify
+EXAMPLES:=query_seq_code log_usertag_proxy job_reg feed_shark notify query_ext
 FAKE_EXAMPLES:=job_log_fake job_reg_fake logevent_fake
 FAKE_EXAMPLES_SOURCES:=job_log.c job_reg.c
 
index ac7c27b..1eaeb45 100644 (file)
@@ -158,10 +158,3 @@ int edg_wll_JobLog(
 
        return edg_wll_QueryEvents(ctx,j,e,eventsOut);
 }
-
-/* XXX missing */
-int edg_wll_QuerySequenceCode(edg_wll_Context ctx, edg_wlc_JobId jobId, char **code)
-{
-       return edg_wll_SetError(ctx, EOPNOTSUPP, NULL);
-}      
-
index f6b4068..0346f73 100644 (file)
@@ -204,17 +204,17 @@ int edg_wll_open_proxy(edg_wll_Context ctx)
 
        memset(&saddr, 0, sizeof(saddr));
        saddr.sun_family = AF_UNIX;
-       if (!ctx->p_proxy_filename) {
+       if (!ctx->p_lbproxy_serve_sock) {
                edg_wll_SetError(ctx, EINVAL, "Proxy socket path not set!");
                goto err;
        }
        
-       if (strlen(ctx->p_proxy_filename) > 108) {      // UNIX_PATH_MAX (def. in linux/un.h)
+       if (strlen(ctx->p_lbproxy_serve_sock) > 108) {  // UNIX_PATH_MAX (def. in linux/un.h)
                                                        // but not defined in sys/un.h
                 edg_wll_SetError(ctx, EINVAL, "proxy_filename too long!");
                 goto err;
        }
-       strcpy(saddr.sun_path, ctx->p_proxy_filename);
+       strcpy(saddr.sun_path, ctx->p_lbproxy_serve_sock);
 
        if ((flags = fcntl(ctx->connPlain->sock, F_GETFL, 0)) < 0 || 
                        fcntl(ctx->connPlain->sock, F_SETFL, flags | O_NONBLOCK) < 0) {
index bad3f4b..14059ad 100644 (file)
@@ -379,44 +379,6 @@ int edg_wll_QueryListener(edg_wll_Context ctx, edg_wlc_JobId job, const char *na
 }
 
 
-
-int edg_wll_QuerySequenceCode(edg_wll_Context ctx, edg_wlc_JobId jobId, char **code) 
-{
-       int     error           = 0;
-       char    *response       = NULL,
-               *message        = NULL,
-               *send_mess      = NULL;
-       
-       
-       edg_wll_ResetError(ctx);
-
-       if ( edg_wll_QuerySequenceCodeToXML(ctx, jobId, &send_mess) != 0 )
-       {
-               edg_wll_SetError(ctx , (edg_wll_ErrorCode) EINVAL, "Invalid query record.");
-               goto err;
-       }
-
-       ctx->p_tmp_timeout = ctx->p_query_timeout; 
-       
-       error = edg_wll_http_send_recv_proxy(ctx, "POST /querySequenceCode HTTP/1.1",
-                       request_headers, send_mess, &response, NULL, &message);
-       if ( error != 0 )
-               goto err;
-
-       if (http_check_status(ctx,response))
-               goto err;
-
-       edg_wll_ParseQuerySequenceCodeResult(ctx,message,code);
-
-err:
-       free(response);
-       free(message);
-       free(send_mess);
-       return edg_wll_Error(ctx,NULL,NULL);
-
-}
-
-
 int set_server_name_and_port(edg_wll_Context ctx, const edg_wll_QueryRec **job_conditions)
 {
        int                             i = 0, j,
@@ -479,6 +441,43 @@ int set_server_name_and_port(edg_wll_Context ctx, const edg_wll_QueryRec **job_c
        return(error);
 }
 
+int edg_wll_QuerySequenceCodeProxy(edg_wll_Context ctx, edg_wlc_JobId jobId, char **code) 
+{
+       int             error = 0;
+       char   *response = NULL,
+                  *message     = NULL,
+                  *send_mess = NULL;
+       
+       
+       ctx->isProxy = 1;
+       edg_wll_ResetError(ctx);
+
+       if ( edg_wll_QuerySequenceCodeToXML(ctx, jobId, &send_mess) != 0 )
+       {
+               edg_wll_SetError(ctx , (edg_wll_ErrorCode) EINVAL, "Invalid query record.");
+               goto err;
+       }
+
+       ctx->p_tmp_timeout = ctx->p_query_timeout; 
+       
+       error = edg_wll_http_send_recv_proxy(ctx, "POST /querySequenceCode HTTP/1.1",
+                       request_headers, send_mess, &response, NULL, &message);
+       if ( error != 0 )
+               goto err;
+
+       if (http_check_status(ctx,response))
+               goto err;
+
+       edg_wll_ParseQuerySequenceCodeResult(ctx,message,code);
+
+err:
+       free(response);
+       free(message);
+       free(send_mess);
+
+       return edg_wll_Error(ctx,NULL,NULL);
+}
+
 
 /******************************************************************
  * Proxy wrappers
index 3521226..a264360 100644 (file)
@@ -180,6 +180,7 @@ static int edg_wll_DoLogEventProxy(
        fprintf(stderr,"Logging to L&B Proxy at socket %s\n",
                context->p_lbproxy_store_sock? context->p_lbproxy_store_sock: socket_path);
 #endif
+       memset(&conn, 0, sizeof(conn));
        conn.sock = socket(PF_UNIX, SOCK_STREAM, 0);
        if (conn.sock < 0) {
                edg_wll_SetError(context,answer = errno,"socket() error");
@@ -729,7 +730,7 @@ int edg_wll_SetLoggingJobProxy(
 
        /* query LBProxyServer for sequence code if not user-suplied */
        if (!code) {
-               edg_wll_QuerySequenceCode(context, job, &code_loc);
+               edg_wll_QuerySequenceCodeProxy(context, job, &code_loc);
                goto err;       
        }
        else