![]() |
Hi, Christoph Stotz wrote: > > How do you changed the assignModem behaviour ? Any patch or code > snippit avaible ? > Yes, but I don't use (test) it! It's a small patch but a major change to faxq behavior : - now runScheduler is not the main function - out of date jobs will not be process in the same order - idem for events - runScheduler could exit with dead jobs in the run queue - run queue could become very large,(spool directories). and so on. So old problems could pop up, and many new ones could pour in :( It's up to you. Didier *** /Y/hylafax/baseline/faxd/Modem.c++ Tue Jul 21 00:42:18 1998 --- /home/fao/hylafax.C015/faxd/Modem.c++ Mon Jul 27 00:24:26 1998 *************** *** 136,143 **** * work associated with the specified job. */ Modem* ! Modem::findModem(const Job& job) { RegEx* c = ModemClass::find(job.device); if (c) { /* --- 136,144 ---- * work associated with the specified job. */ Modem* ! Modem::findModem(const Job& job, fxBool *nofound) { + *nofound = TRUE; RegEx* c = ModemClass::find(job.device); if (c) { /* *************** *** 149,154 **** --- 150,156 ---- Modem& modem = iter; if (modem.getState() != Modem::READY) continue; + *nofound = FALSE; if (c->Find(modem.devID) && modem.isCapable(job)) return (&modem); } *************** *** 162,167 **** --- 164,170 ---- Modem& modem = iter; if (modem.getState() != Modem::READY) continue; + *nofound = FALSE; if (job.device != modem.devID) continue; return (modem.isCapable(job) ? &modem : (Modem*) NULL); *** /Y/hylafax/baseline/faxd/Modem.h Sun May 4 20:31:02 1997 --- /home/fao/hylafax.C015/faxd/Modem.h Mon Jul 27 00:23:18 1998 *************** *** 107,113 **** static Modem& getModemByID(const fxStr& id); static Modem* modemExists(const fxStr& id); ! static Modem* findModem(const Job& job); fxBool assign(Job&); // assign modem void release(); // release modem --- 107,113 ---- static Modem& getModemByID(const fxStr& id); static Modem* modemExists(const fxStr& id); ! static Modem* findModem(const Job& job, fxBool *nofound); fxBool assign(Job&); // assign modem void release(); // release modem *** /Y/hylafax/baseline/faxd/faxQueueApp.c++ Thu Jul 16 02:03:34 1998 --- /home/fao/hylafax.C015/faxd/faxQueueApp.c++ Mon Jul 27 00:29:30 1998 *************** *** 1996,2001 **** --- 1996,2002 ---- close(); return; } + int rep; /* * Reread the configuration file if it has been * changed. We do this before each scheduler run *************** *** 2098,2104 **** job.remove(); // remove from run queue delayJob(job, *req, "Delayed by time-of-day restrictions", tts); delete req; ! } else if (assignModem(job)) { job.remove(); // remove from run queue /* * We have a modem and have assigned it to the --- 2099,2109 ---- job.remove(); // remove from run queue delayJob(job, *req, "Delayed by time-of-day restrictions", tts); delete req; ! } else if (0 != (rep = assignModem(job))) { ! if (-1 == rep) { ! delete req; ! break; ! } job.remove(); // remove from run queue /* * We have a modem and have assigned it to the *************** *** 2141,2159 **** * do not get information about when modems are in * use from faxgetty processes. */ ! fxBool faxQueueApp::assignModem(Job& job) { fxAssert(job.modem == NULL, "Assigning modem to job that already has one"); ! fxBool retryModemLookup; do { retryModemLookup = FALSE; ! Modem* modem = Modem::findModem(job); if (modem) { if (modem->assign(job)) { Trigger::post(Trigger::MODEM_ASSIGN, *modem); ! return (TRUE); } /* * Modem could not be assigned to job. The --- 2146,2164 ---- * do not get information about when modems are in * use from faxgetty processes. */ ! int faxQueueApp::assignModem(Job& job) { fxAssert(job.modem == NULL, "Assigning modem to job that already has one"); ! fxBool noModemReady; fxBool retryModemLookup; do { retryModemLookup = FALSE; ! Modem* modem = Modem::findModem(job, &noModemReady); if (modem) { if (modem->assign(job)) { Trigger::post(Trigger::MODEM_ASSIGN, *modem); ! return (1); } /* * Modem could not be assigned to job. The *************** *** 2172,2178 **** } else traceJob(job, "No assignable modem located"); } while (retryModemLookup); ! return (FALSE); } /* --- 2177,2183 ---- } else traceJob(job, "No assignable modem located"); } while (retryModemLookup); ! return (noModemReady?-1:0); } /* *** /Y/hylafax/baseline/faxd/faxQueueApp.h Sun May 4 20:31:02 1997 --- /home/fao/hylafax.C015/faxd/faxQueueApp.h Mon Jul 27 00:25:53 1998 *************** *** 153,159 **** fxStr canonicalizePhoneNumber(const fxStr& ds); // modem support void scanForModems(); ! fxBool assignModem(Job& job); void releaseModem(Job& job); void notifyModemWedged(Modem&); void pollForModemLock(Modem& modem); --- 153,160 ---- fxStr canonicalizePhoneNumber(const fxStr& ds); // modem support void scanForModems(); ! // fxBool assignModem(Job& job); ! int assignModem(Job& job); void releaseModem(Job& job); void notifyModemWedged(Modem&); void pollForModemLock(Modem& modem);