Browse code

handle end of session handle EOF on dspresult

git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4700 77e5149b-7576-45b1-b177-96237e5ba77b

aCaB authored on 2009/02/08 02:53:33
Showing 1 changed files
... ...
@@ -109,6 +109,8 @@ int recvln(struct RCVLN *s, char **rbol, char **reol) {
109 109
 		    logg("!Communication error\n");
110 110
 		    return -1;
111 111
 		}
112
+		*rbol = NULL;
113
+		if(reol) *reol = eol;
112 114
 	        return 0;
113 115
 	    }
114 116
 	}
... ...
@@ -397,6 +399,7 @@ int dspresult(struct client_parallel_data *c) {
397 397
 	    c->errors++;
398 398
 	    break;
399 399
 	}
400
+	if(!bol) return 0;
400 401
 	if((rid = atoi(bol))) {
401 402
 	    id = &c->ids;
402 403
 	    while(*id) {
... ...
@@ -535,6 +538,9 @@ int parallel_client_scan(const char *file, int scantype, int *infected, int *err
535 535
 	if(dspresult(&cdata)) { /* FIXME: return something */ }
536 536
     };
537 537
 
538
+    sendln(cdata.sockd, "zEND", 5);
539
+    close(cdata.sockd);
540
+
538 541
     if(!cdata.infected && (!cdata.errors || cdata.spam)) logg("~%s: OK\n", file);
539 542
 
540 543
     *infected += cdata.infected;