]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Per Lee on Bug 733:
authorAidan Van Dyk <aidan@ifax.com>
Mon, 24 Apr 2006 16:32:39 +0000 (16:32 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Mon, 24 Apr 2006 16:32:39 +0000 (16:32 +0000)
unblockDestJobs really shouldn't be called from unblockDestInfo in that the
two really aren't completely related.  Instead, call unblockDestJobs at more
appropriate times, making sure that the timing of di.hangup precedes it when
appropriate.

CHANGES
faxd/faxQueueApp.c++

diff --git a/CHANGES b/CHANGES
index 8b10715148da4243f21738084b0d809dad24626d..3bc4a6239722097e1879cbeb5395fbd2786e193c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,7 @@
 
 Changelog
 
+* Fix unblocking job problem (BUG 733) (24 Apr 2006)
 * back out flush modem I/O (BUG 756) (24 Apr 2006)
 * Make sure hfaxd returns JBIG faxes in recvq list (BUG 731) (23 Apr 2006)
 * Resolve Solaris bus error under native compiler (BUG 769) (23 Apr 2006)
index c98e990a8cc253e21984f7be7981206cb4220861..d674750488e81124c68b6b12fd2e0bd1200df428 100644 (file)
@@ -451,9 +451,9 @@ faxQueueApp::prepareJobDone(Job& job, int status)
                 * This destination was marked as called, but all jobs to this
                 * destination failed preparation, so we must undo the call marking.
                 */
+               removeDestInfoJob(job);         // release destination block
                DestInfo& di = destJobs[job.dest];
-               di.hangup();
-               removeDestInfoJob(job);         // release any blocked jobs/release destination block
+               unblockDestJobs(job, di);       // release any blocked jobs
            }
        }
     }
@@ -1411,6 +1411,8 @@ faxQueueApp::sendJobDone(Job& job, int status)
     Job* cjob;
     Job* njob;
     DestInfo& di = destJobs[job.dest];
+    di.hangup();                               // do before unblockDestJobs
+    releaseModem(job);                         // done with modem
     FaxRequest* req = readRequest(job);
     if (req && req->status == send_retry) {
        // prevent turnaround-redialing, delay any blocked jobs
@@ -1425,9 +1427,6 @@ faxQueueApp::sendJobDone(Job& job, int status)
     } else {
        unblockDestJobs(job, di);
     }
-    di.hangup();
-    releaseModem(job);                         // done with modem
-
     traceQueue(job, "CMD DONE: exit status %#x", status);
     if (status&0xff)
        logError("Send program terminated abnormally with exit status %#x", status);
@@ -2248,14 +2247,21 @@ faxQueueApp::unblockDestJobs(Job& job, DestInfo& di)
      */
     Job* jb;
     u_int n = 1;
-    while (isOKToCall(di, job.getJCI(), n) && (jb = di.nextBlocked())) {
-       setReadyToRun(*jb);
-       if (!di.supportsBatching()) n++;
-       FaxRequest* req = readRequest(*jb);
-       if (req) {
-           req->notice = "";
-           updateRequest(*req, *jb);
-           delete req;
+    while ( (jb = di.nextBlocked()) ) {
+       if ( isOKToCall(di, job.getJCI(), n) )
+       {
+           setReadyToRun(*jb);
+           if (!di.supportsBatching()) n++;
+           FaxRequest* req = readRequest(*jb);
+           if (req) {
+               req->notice = "";
+               updateRequest(*req, *jb);
+               delete req;
+           }
+       } else
+       {
+           traceJob(job, "Continue BLOCK, current calls: %d, max concurrent calls: %d", 
+               di.getCalls(), job.getJCI().getMaxConcurrentCalls());
        }
     }
 }
@@ -2266,9 +2272,7 @@ faxQueueApp::removeDestInfoJob(Job& job)
     DestInfo& di = destJobs[job.dest];
     di.done(job);                      // remove from active destination list
     di.updateConfig();                 // update file if something changed
-    if (!di.isEmpty()) {
-       unblockDestJobs(job, di);
-    } else {
+    if (di.isEmpty()) {
        /*
         * This is the last job to the destination; purge
         * the entry from the destination jobs database.