special behaviour when EDG_WLL_GSS_ERROR_EOF occurs
authorJan Pospíšil <honik@ntc.zcu.cz>
Sun, 11 Feb 2007 18:21:36 +0000 (18:21 +0000)
committerJan Pospíšil <honik@ntc.zcu.cz>
Sun, 11 Feb 2007 18:21:36 +0000 (18:21 +0000)
org.glite.lb.logger/src/logd.c
org.glite.lb.logger/src/logd_proto.c

index 3e4dee1..ad3a120 100644 (file)
@@ -236,10 +236,14 @@ doit(int socket, gss_cred_id_t cred_handle, char *file_name_prefix, int noipc, i
                break;
        }
        if (FD_ISSET(con.sock,&fdset)) {
-               if ((ret = edg_wll_log_proto_server(&con,&timeout,subject,file_name_prefix,noipc,noparse)) != 0) {
+               ret = edg_wll_log_proto_server(&con,&timeout,subject,file_name_prefix,noipc,noparse);
+               if (ret != 0) {
                        edg_wll_ll_log(LOG_DEBUG,"timeout after edg_wll_log_proto_server is %d.%06d sec\n",
                                (int)timeout.tv_sec, (int) timeout.tv_usec);
-                       edg_wll_ll_log(LOG_ERR,"edg_wll_log_proto_server() error\n");
+                       if (ret != EDG_WLL_GSS_ERROR_EOF) 
+                               edg_wll_ll_log(LOG_ERR,"edg_wll_log_proto_server(): Error\n");
+                       else if (count == 1)
+                               edg_wll_ll_log(LOG_ERR,"edg_wll_log_proto_server(): Error. EOF occured.\n");
                        timeout.tv_sec = 0;
                        timeout.tv_usec = 0;
                        break;
index d64c8c1..0f89bea 100644 (file)
@@ -301,8 +301,14 @@ int edg_wll_log_proto_server(edg_wll_GssConnection *con, struct timeval *timeout
        edg_wll_ll_log(LOG_INFO,"Reading socket header...");
        memset(header, 0, EDG_WLL_LOG_SOCKET_HEADER_LENGTH+1);
        if ((err = edg_wll_gss_read_full(con, header, EDG_WLL_LOG_SOCKET_HEADER_LENGTH, timeout, &count, &gss_stat)) < 0) {
-               edg_wll_ll_log(LOG_INFO,"error.\n");
-               answer = edg_wll_log_proto_server_failure(err,&gss_stat,"Error receiving header");
+               if (err == EDG_WLL_GSS_ERROR_EOF) {
+                       edg_wll_ll_log(LOG_INFO,"no data available.\n");
+                       answer = err;
+                       answer_sent = 1; /* i.e. do not try to send answer back */
+               } else {
+                       edg_wll_ll_log(LOG_INFO,"error.\n");
+                       answer = edg_wll_log_proto_server_failure(err,&gss_stat,"Error receiving header");
+               }
                goto edg_wll_log_proto_server_end;
        } else {
                edg_wll_ll_log(LOG_INFO,"o.k.\n");
@@ -453,7 +459,7 @@ int edg_wll_log_proto_server(edg_wll_GssConnection *con, struct timeval *timeout
        /* if not command, save message to file */
        if(strstr(msg, "DG.TYPE=\"command\"") == NULL) {
                /* compose the name of the log file */
-               edg_wll_ll_log(LOG_DEBUG,"Composing filename from prefix \"%s\" and unique jobId \"%s\"...",prefix,jobId);
+//             edg_wll_ll_log(LOG_DEBUG,"Composing filename from prefix \"%s\" and unique jobId \"%s\"...",prefix,jobId);
                count = strlen(prefix);
                strncpy(outfilename,prefix,count); count_total=count;
                strncpy(outfilename+count_total,".",1); count_total+=1; count=strlen(jobId);
@@ -553,7 +559,7 @@ edg_wll_log_proto_server_end:
        if (msg) free(msg);
        if (event) free(event);
 
-       edg_wll_ll_log(LOG_INFO,"Done.\n");
+//     edg_wll_ll_log(LOG_INFO,"Done.\n");
 
        return answer;