In 254 I introduced an important bug: ts -t marked the running job as
authorviric@mandarina
Fri, 05 Dec 2008 17:40:49 +0000
changeset 256 638fcfee37c6
parent 255 fda6c6df47c4
child 257 18d5bf8fa969
In 254 I introduced an important bug: ts -t marked the running job as finished. Fixing it.
server.c
--- a/server.c	Fri Dec 05 10:44:38 2008 +0000
+++ b/server.c	Fri Dec 05 17:40:49 2008 +0000
@@ -270,7 +270,7 @@
 {
     /* Act as if the job ended. */
     int jobid = client_cs[index].jobid;
-    if (job_is_running(jobid))
+    if (client_cs[index].hasjob && job_is_running(jobid))
     {
         struct Result r;
 
@@ -291,14 +291,13 @@
          * when we receive the EOC. */
         client_cs[index].hasjob = 0;
     }
+    else
+        /* If it doesn't have a running job,
+         * it may well be a notification */
+        s_remove_notification(socket);
 
     close(socket);
-    /* TODO: if the client dies while its job is running, someone may prefer
-     * to note the job as finished with an error. Now we simply remove
-     * it from the queue. */
     remove_connection(index);
-    /* It will not fail, even if the index is not a notification */
-    s_remove_notification(socket);
 }
 
 static enum Break