]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
[Bug 117] Changed - HylaFAX doesn't handle EOM correctly
authorDarren Nickerson <darren.nickerson@ifax.com>
Mon, 2 Jul 2001 07:03:59 +0000 (07:03 +0000)
committerDarren Nickerson <darren.nickerson@ifax.com>
Mon, 2 Jul 2001 07:03:59 +0000 (07:03 +0000)
Applied Lee's patch.

faxd/Class1.h
faxd/Class1Recv.c++
faxd/Class2.h
faxd/Class2Recv.c++
faxd/FaxModem.h
faxd/FaxRecv.c++

index e3333eb47eba681dced14a6b5b38c0119f9188f0..b5c45ae718e0da39cc4ffc3191bf32b98bf82182 100644 (file)
@@ -167,6 +167,8 @@ public:
     bool       recvPage(TIFF*, int& ppm, fxStr& emsg);
     bool       recvEnd(fxStr& emsg);
     void       recvAbort();
+    void       trainingSucceeded();
+    void       trainingFailed();
 
 // polling support
     bool       requestToPoll(fxStr&);
index ed673a61999e6cf483f5fc9469a171648ae91148..98b3aad0957344c1d3c72c8f38ff025904339a3d 100644 (file)
@@ -301,21 +301,33 @@ Class1Modem::recvTraining()
        }
        (void) waitFor(AT_NOCARRIER);   // wait for message carrier to drop
     }
-    /*
-     * Send training response; we follow the spec
-     * by delaying 75ms before switching carriers.
-     */
-    pause(conf.class1TCFResponseDelay);
-    if (ok) {
-       transmitFrame(FCF_CFR|FCF_RCVR);
-       protoTrace("TRAINING succeeded");
-    } else {
-       transmitFrame(FCF_FTT|FCF_RCVR);
-       protoTrace("TRAINING failed");
-    }
     return (ok);
 }
 
+/*
+ * Send training response (success); we follow the spec
+ * by delaying 75ms before switching carriers.
+ */
+void
+Class1Modem::trainingSucceeded()
+{
+    pause(conf.class1TCFResponseDelay);
+    transmitFrame(FCF_CFR|FCF_RCVR);
+    protoTrace("TRAINING succeeded");
+}
+
+/*
+ * Send training response (failure); we follow the spec
+ * by delaying 75ms before switching carriers.
+ */
+void
+Class1Modem::trainingFailed()
+{
+    pause(conf.class1TCFResponseDelay);
+    transmitFrame(FCF_FTT|FCF_RCVR);
+    protoTrace("TRAINING failed");
+}
+
 /*
  * Process a received DCS frame.
  */
@@ -455,6 +467,8 @@ top:
                    && recvDCSFrames(frame)
                    && recvTraining()
                );
+               if (messageReceived) trainingFailed();
+               else trainingSucceeded();
                break;
            case FCF_MPS:                       // MPS
            case FCF_EOM:                       // EOM
@@ -552,8 +566,10 @@ top:
         * timeout, we need to achieve CONNECT first, just
         * as we did following ATA back in the beginning.
         */
-       if (atCmd(thCmd, AT_NOTHING) && atResponse(rbuf, 0) == AT_CONNECT && recvBegin(emsg))
+       if (atCmd(thCmd, AT_NOTHING) && atResponse(rbuf, 0) == AT_CONNECT && recvBegin(emsg)) {
+           trainingSucceeded();
            goto top;
+       } else trainingFailed();
     } else
        emsg = "T.30 T2 timeout, expected page not received";
     return (false);
index cb0787cf3be08082091d086c18cd71efc058a408..40efeb532a625f4e1fbd15ecabbdaf711434456b 100644 (file)
@@ -147,6 +147,8 @@ public:
     bool       recvPage(TIFF*, int& ppm, fxStr& emsg);
     bool       recvEnd(fxStr& emsg);
     void       recvAbort();
+    void       trainingSucceeded();
+    void       trainingFailed();
 
 // polling support
     bool       requestToPoll(fxStr& emsg);
index abdb594d62b1bf6ce6391cbd7080f531c72743a9..8be8fddf613fd50a6868d61dd011218ab8ffa4b4 100644 (file)
@@ -346,3 +346,23 @@ Class2Modem::recvAbort()
 {
     strcpy(hangupCode, "50");                  // force abort in recvEnd
 }
+
+/*
+ * Processes to perform at the end of training,
+ * but after TSI screening, so we know where
+ * we're going.
+ */
+void
+Class2Modem::trainingSucceeded()
+{
+    // nothing
+}
+
+/*
+ * ibid.
+ */
+void
+Class2Modem::trainingFailed()
+{
+    // nothing
+}
index 625360269e2c08508be9a8bfc16501d41ad7ca25..17324cb94613bb26d3f80b6ca15fa3b3f5eac4b3 100644 (file)
@@ -251,6 +251,8 @@ public:
     virtual bool recvPage(TIFF*, int& ppm, fxStr& em) = 0;
     virtual bool recvEnd(fxStr& emsg) = 0;
     virtual void recvAbort() = 0;
+    virtual void trainingSucceeded() = 0;
+    virtual void trainingFailed() = 0;
     // query interfaces for optional state
     virtual bool getRecvPWD(fxStr&);
     virtual bool getRecvTSI(fxStr&);
index 9ef616b6529757532a1087a42e56248bc8016316..2a9fe3a9fedc0d913290bb66247d7154d22a378f 100644 (file)
@@ -74,6 +74,7 @@ FaxServer::recvFax(const CallerID& cid)
            if (!modem->recvEnd(emsg))
                traceProtocol("RECV FAX: %s", (const char*) emsg);
        } else {
+           modem->trainingFailed();            // wait until after QualifyTSI
            traceProtocol("RECV FAX: %s", (const char*) emsg);
            TIFFClose(tif);
        }
@@ -219,6 +220,7 @@ FaxServer::recvDocuments(TIFF* tif, FaxRecvInfo& info, FaxRecvInfoArray& docs, f
                return (false);
            }
        }
+       modem->trainingSucceeded();             // wait until after QualifyTSI
        setServerStatus("Receiving from \"%s\"", (const char*) info.sender);
        recvOK = recvFaxPhaseD(tif, info, ppm, emsg);
        TIFFClose(tif);