]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Bug 557: limit TSI/DCS/TCF retrain opportunities to allowed instances
authorLee Howard <faxguy@howardsilvan.com>
Mon, 28 Jun 2004 19:23:55 +0000 (19:23 +0000)
committerLee Howard <faxguy@howardsilvan.com>
Mon, 28 Jun 2004 19:23:55 +0000 (19:23 +0000)
faxd/Class1Send.c++
faxd/Class2Send.c++
faxd/FaxSend.c++
faxd/FaxServer.h

index 50b274a3f381c534bcac57df3934496805155aa0..8597857c48040f034036acf0e81a7e833b773fe4 100644 (file)
@@ -400,10 +400,16 @@ Class1Modem::sendPhaseB(TIFF* tif, Class2Params& next, FaxMachineInfo& info,
                        protoTrace(emsg);
                        return (send_failed);
                    }
-                   FaxSendStatus status =
-                       sendSetupParams(tif, next, info, emsg);
-                   if (status != send_ok)
-                       return (status);
+                   /*
+                    * The session parameters cannot change except following
+                    * the reception of an RTN signal or the transmission of an
+                    * EOM signal.
+                    *
+                    * Since we did not receive RTN, and since batching (EOM)
+                    * triggers retraining in other ways, we require that the
+                    * next page have the same characteristics as this page.
+                    */
+                   next = params;
                }
                break;
            case FCF_DCN:               // disconnect, abort
index afdf0335c45d5907b8808e628e3db5e505d8477d..2fdf129f944f44b8fad7f1c9ecefff7f030ad78b 100644 (file)
@@ -302,12 +302,16 @@ Class2Modem::sendPhaseB(TIFF* tif, Class2Params& next, FaxMachineInfo& info,
                            emsg = "Problem reading document directory";
                            goto failed;
                        }
-                       FaxSendStatus status =
-                           sendSetupParams(tif, next, info, emsg);
-                       if (status != send_ok) {
-                           sendAbort();
-                           return (status);
-                       }
+                       /*
+                        * The session parameters cannot change except following
+                        * the reception of an RTN signal or the transmission of an
+                        * EOM signal.
+                        *
+                        * Since we did not receive RTN, and since batching (EOM)
+                        * triggers retraining in other ways, we require that the
+                        * next page have the same characteristics as this page.
+                        */
+                       next = params;
                    }
                    transferOK = true;
                    break;
index ace3d98ae4847f7562b1063d5dd8e297b6e92ca1..23a6db619f4dc35790c36e9d81fe0f5fd449ce73 100644 (file)
@@ -212,7 +212,8 @@ FaxServer::sendFax(FaxRequest& fax, FaxMachineInfo& clientInfo, const fxStr& num
                /*
                 * Group 3 protocol forces any sends to precede any polling.
                 */
-               fax.status = send_done;                 // be optimistic
+               fax.status = send_failed;
+               bool dosetup = true;
                while (fax.items.length() > 0) {        // send operations
                    u_int i = fax.findItem(FaxRequest::send_fax);
                    if (i == fx_invalidArrayIndex)
@@ -220,7 +221,7 @@ FaxServer::sendFax(FaxRequest& fax, FaxMachineInfo& clientInfo, const fxStr& num
                    FaxItem& freq = fax.items[i];
                    traceProtocol("SEND file \"%s\"", (const char*) freq.item);
                    fileStart = pageStart = Sys::now();
-                   if (!sendFaxPhaseB(fax, freq, clientInfo, batched)) {
+                   if (!sendFaxPhaseB(fax, freq, clientInfo, batched, dosetup)) {
                        /*
                         * Prevent repeated batching errors.
                         */
@@ -254,6 +255,7 @@ FaxServer::sendFax(FaxRequest& fax, FaxMachineInfo& clientInfo, const fxStr& num
                     * find again at the top of the loop
                     */
                    notifyDocumentSent(fax, i);
+                   dosetup = false;
                }
                if (fax.status == send_done &&
              fax.findItem(FaxRequest::send_poll) != fx_invalidArrayIndex)
@@ -395,14 +397,14 @@ FaxServer::sendPoll(FaxRequest& fax, bool remoteHasDoc)
  * Phase B of Group 3 protocol.
  */
 bool
-FaxServer::sendFaxPhaseB(FaxRequest& fax, FaxItem& freq, FaxMachineInfo& clientInfo, u_int batched)
+FaxServer::sendFaxPhaseB(FaxRequest& fax, FaxItem& freq, FaxMachineInfo& clientInfo, u_int batched, bool dosetup)
 {
-    fax.status = send_failed;                  // assume failure
-
     TIFF* tif = TIFFOpen(freq.item, "r");
     if (tif && (freq.dirnum == 0 || TIFFSetDirectory(tif, freq.dirnum))) {
-       // set up DCS according to file characteristics
-       fax.status = sendSetupParams(tif, clientParams, clientInfo, fax.notice);
+       if (dosetup) {
+           // set up DCS according to file characteristics
+           fax.status = sendSetupParams(tif, clientParams, clientInfo, fax.notice);
+       }
        if (fax.status == send_ok) {
            /*
             * Count pages sent and advance dirnum so that if we
index d293b05779380bb8961e53e14bd353d3f2776684..6b8218996f00c69ed3e27acfa904bd3ab926c7b9 100644 (file)
@@ -63,7 +63,7 @@ private:
 // FAX transmission protocol support
     void       sendFax(FaxRequest& fax, FaxMachineInfo&, const fxStr& number, u_int&);
     bool       sendClientCapabilitiesOK(FaxRequest&, FaxMachineInfo&, fxStr&);
-    bool       sendFaxPhaseB(FaxRequest&, FaxItem&, FaxMachineInfo&, u_int);
+    bool       sendFaxPhaseB(FaxRequest&, FaxItem&, FaxMachineInfo&, u_int, bool);
     void       sendPoll(FaxRequest& fax, bool remoteHasDoc);
     FaxSendStatus sendSetupParams(TIFF*,
                    Class2Params&, const FaxMachineInfo&, fxStr&);