Fixing the cleaning of the job list in case of ctrl-c on a blocked client
enqueuing.
--- a/jobs.c Mon Jul 18 22:22:55 2011 +0200
+++ b/jobs.c Mon Jul 18 22:38:02 2011 +0200
@@ -627,9 +627,11 @@
if (p == 0)
error("on jobid %i finished, it doesn't exist", jobid);
- if (p->state != RUNNING)
- error("on jobid %i finished, it is not running but %i",
- jobid, p->state);
+ /* The job may be not only in running state, but also in other states, as
+ * we call this to clean up the jobs list in case of the client closing the
+ * connection. */
+ if (p->state == RUNNING)
+ --busy_slots;
/* Mark state */
if (result->skipped)
@@ -679,8 +681,6 @@
*jpointer = newfirst;
}
-
- --busy_slots;
}
void s_clear_finished()
--- a/server.c Mon Jul 18 22:22:55 2011 +0200
+++ b/server.c Mon Jul 18 22:38:02 2011 +0200
@@ -173,7 +173,7 @@
/* Arbitrary limit, that will block the enqueuing, but should allow space
* for usual ts queries */
- max_jobs = max_descriptors - 5;
+ max_jobs = 2;
path = _path;
@@ -322,7 +322,7 @@
{
/* Act as if the job ended. */
int jobid = client_cs[index].jobid;
- if (client_cs[index].hasjob && job_is_running(jobid))
+ if (client_cs[index].hasjob)
{
struct Result r;