]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
We can't rely on the timeout value to know if CONNECT has been seen
authorAidan Van Dyk <aidan@ifax.com>
Wed, 14 Mar 2007 18:27:43 +0000 (18:27 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Wed, 14 Mar 2007 18:27:43 +0000 (18:27 +0000)
Based on Lee's work:
|  commit 20678e9f4e755bcb192b93dfb6298d971d261b19
|  Author: Lee Howard <faxguy@howardsilvan.com>
|  Date:   Sat Sep 30 15:56:55 2006 +0000
|
|    this should handle the non-ECM case for gotCONNECT usage

|  commit de6ff8aa35e95d99cec03b46b8cf8f827f56db36
|  Author: Lee Howard <faxguy@howardsilvan.com>
|  Date:   Sat Sep 30 02:19:11 2006 +0000
|
|    On Sep 8 a change was made to recvFrame which caused (correctly so) the timeout
|    value to be cleared after a successful abortReceive.  However, the side-effect
|    of this was that the "recv pps" portion of the ECM code was depending on that
|    timeout value to know if CONNECT was even seen in the attempt or not.
|
|    So this fixes that condition by creating a global flag specifically for this
|    purpose.  I hesitate a bit in doing it this way (I'd prefer to change recvFrame's
|    exit value to int instead of bool), but right now it seems to most straight-
|    forward approach.

CHANGES
faxd/Class1.c++
faxd/Class1.h
faxd/Class1Recv.c++

diff --git a/CHANGES b/CHANGES
index 10204acf3a526d383dd1f87a4fe9bd4b63852b77..38eb1e73c9e9f4d83bebbdd02554cc243a04c298 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,7 @@
 
 Changelog since HylaFAX 4.3.3
 
+* We can't rely on the timeout value to know if CONNECT has been seen (12 Mar 2007)
 * Calculate PPM/PPS waiter instead of using T1
 * Improve response handling of AT+FRH=3 (12 Mar 2007)
 * Improve ECM HDLC frame decoder to recover more quickly from data corruption
index efd5337abe4cc046b1548a89f1d7bfba629c398f..a50be5e0590351376016e364128dc8805f5ae368 100644 (file)
@@ -1371,6 +1371,7 @@ Class1Modem::recvFrame(HDLCFrame& frame, u_char dir, long ms, bool readPending,
 {
     bool gotframe;
     u_short crpcnt = 0;
+    gotCONNECT = true;
     if (useV34) {
        do {
            if (crpcnt) traceFCF(dir == FCF_SNDR ? "SEND send" : "RECV send", FCF_CRP);
@@ -1404,7 +1405,10 @@ Class1Modem::recvFrame(HDLCFrame& frame, u_char dir, long ms, bool readPending,
        } while (!gotframe && docrp && crpcnt++ < 3 && !wasTimeout() &&
                switchingPause(emsg) && transmitFrame(dir|FCF_CRP));
        return (gotframe);
-    } else if (lastResponse == AT_ERROR) gotEOT = true;                // on hook
+    } else {
+       gotCONNECT = false;
+       if (lastResponse == AT_ERROR) gotEOT = true;            // on hook
+    }
     stopTimeout("waiting for v.21 carrier");
     if (wasTimeout()) abortReceive();
     return (false);
index c1f8dea606865c3d98d34a11ad063a514ac990da..e8953d5d4bd2b75ff8e645a9b1ace74bc4beaba6 100644 (file)
@@ -111,6 +111,7 @@ protected:
 // V.34 indicators
     bool       useV34;         // whether or not V.8 handhaking was used
     bool       gotEOT;         // V.34-fax heard EOT signal
+    bool       gotCONNECT;     // whether or not CONNECT was seen
     bool       gotCTRL;        // current channel indicator
     bool       gotRTNC;        // retrain control channel
     u_short    primaryV34Rate; // rate indication for primary channel
index a887a6f69c9b65c6516d3f76b370d42e76dc222a..e9e585366bd7e397553d635260c262014c0eeeca 100644 (file)
@@ -511,6 +511,7 @@ Class1Modem::recvPage(TIFF* tif, u_int& ppm, fxStr& emsg, const fxStr& id)
     time_t t2end = 0;
     signalRcvd = 0;
     sendERR = false;
+    gotCONNECT = true;
 
     do {
        u_int timer = conf.t2Timer;
@@ -607,7 +608,6 @@ Class1Modem::recvPage(TIFF* tif, u_int& ppm, fxStr& emsg, const fxStr& id)
                            messageReceived = true;
                        }
                    }
-                   if (wasTimeout()) abortReceive();
                }
            }
            if (signalRcvd != 0) {
@@ -909,7 +909,7 @@ Class1Modem::recvPage(TIFF* tif, u_int& ppm, fxStr& emsg, const fxStr& id)
                t2end = Sys::now() + howmany(conf.t2Timer, 1000);
            }
        }
-    } while (!wasTimeout() && lastResponse != AT_EMPTYLINE);
+    } while (gotCONNECT && !wasTimeout() && lastResponse != AT_EMPTYLINE);
     emsg = "T.30 T2 timeout, expected page not received";
     if (prevPage && conf.saveUnconfirmedPages && getRecvEOLCount()) {
        TIFFWriteDirectory(tif);
@@ -1306,7 +1306,7 @@ Class1Modem::recvPageECMData(TIFF* tif, const Class2Params& params, fxStr& emsg)
                     */
                    long wait = (80*1024*8) / ((useV34 ? primaryV34Rate : curcap->br+1)*2400) * 1000;
                    gotpps = recvFrame(ppsframe, FCF_RCVR, wait);       // wait longer
-               } while (!gotpps && !wasTimeout() && !gotEOT && ++recvFrameCount < 5);
+               } while (!gotpps && gotCONNECT && !wasTimeout() && !gotEOT && ++recvFrameCount < 5);
                if (gotpps) {
                    traceFCF("RECV recv", ppsframe.getFCF());
                    if (ppsframe.getFCF() == FCF_PPS) {