]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
We only need to "wait" for jobcontrol if we are activly trying to gather
authorAidan Van Dyk <aidan@ifax.com>
Mon, 24 Apr 2006 20:56:03 +0000 (20:56 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Mon, 24 Apr 2006 20:56:03 +0000 (20:56 +0000)
batches.  Waiting at other times is problematic, for instance if were
are waiting after a job starts from a pending state (job submitted for a
future time), on a busy server, sometimes runScheduler() can actuall run
between the time we put the job on the runq in ctrlJobDone(), and the
FaxRequest req is destroyed when unwonding the call stack back to
runJob() (called by the job ttsHandler.timerExpired()).

faxd/faxQueueApp.c++

index 2c821c2dd9c06bc351d8c7f7a0e87e8051f7fdca..4758cc225ef2e76aefbd4224a854b2c25254adcf 100644 (file)
@@ -1646,12 +1646,6 @@ faxQueueApp::setReadyToRun(Job& job)
                Sys::close(pfd[1]);
            }
        }
-       if (jobCtrlWait)
-       {
-           logError("WAITING FOR JobControl to finish");
-           while (job.isEmpty() )
-               Dispatcher::instance().dispatch();
-       }
     } else {
        ctrlJobDone(job, 0);
     }
@@ -2460,6 +2454,12 @@ faxQueueApp::runScheduler()
                            sleepiter.job().state = FaxRequest::state_ready;
                            sleepiter.job().remove();
                            setReadyToRun(sleepiter.job());
+                           if (jobCtrlWait)
+                           {
+                               logError("WAITING FOR JobControl to finish");
+                               while (job.isEmpty() )
+                                   Dispatcher::instance().dispatch();
+                           }
                        }
 
                        Job* bjob = &job;       // Last batched Job