]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
* Flush modem input after NO CARRIER result in Class 1 Phase C send
authorAidan Van Dyk <aidan@ifax.com>
Wed, 14 Mar 2007 18:35:44 +0000 (18:35 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Wed, 14 Mar 2007 18:35:44 +0000 (18:35 +0000)
From Lee:
|  commit eb8957a81476c7ffa890a67166098706e734fcb8
|  Author: Lee Howard <faxguy@howardsilvan.com>
|  Date:   Thu Jul 20 16:48:04 2006 +0000
|
|    I'm coming to more and more of an opinion that we should be checking for
|    modem responses during the entirety of Phase C data transmission - rather
|    than just waiting until after all of the data is transmitted.  But, until
|    we do that...
|
|    Some modems, like iaxmodem and Patton 2977s, are capable of detecting a
|    hangup, and so if that occurs during the middle of Phase C data transmission
|    the modem will respond/result with NO CARRIER before we ever get to end-of-data.
|    Consequently the remaining Phase C data that is sent to the modem can
|    potentially get interpreted as AT commands (if it coincidentally looks like
|    it) and will usually result in repeated ERROR messages.
|
|    We dont want those ERROR messages - or whatever the modem responses were
|    to the junk we sent to it - to be interpreted as responses to our subsequent
|    commands... so we need to flush the modem input.

CHANGES
faxd/Class1Send.c++

diff --git a/CHANGES b/CHANGES
index 83b7f97fbfcbc389a43bfbae50b67fb57f9b1b53..48edab0160045704134c2ebe3d3cafc9916e6794 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,7 @@
 
 Changelog since HylaFAX 4.3.3
 
+* Flush modem input after NO CARRIER result in Class 1 Phase C send (13 Mar 2007)
 * Improve sender-side RNR/RR flow control interaction (13 Mar 2007)
 * Don't fallback to V.17 speeds on TCF retransmisions (13 Mar 2007)
 * Prevent picking up again on the receiver's MCF signal when
index 7c0693ca32fea33d0f06d5dc0d53ab9baf9985f8..fdffb8f427e7826210072f8304aea17b5b87b328 100644 (file)
@@ -1173,6 +1173,18 @@ Class1Modem::blockFrame(const u_char* bitrev, bool lastframe, u_int ppmcmd, fxSt
                ATResponse r;
                while ((r = atResponse(rbuf, getDataTimeout())) == AT_OTHER);
                if (!(r == AT_OK)) {
+                   if (r == AT_NOCARRIER) {
+                       /*
+                        * The NO CARRIER result here is not per-spec.  However,
+                        * some modems capable of detecting hangup conditions will
+                        * use this to indicate a disconnection.  Because we did
+                        * not check for modem responses during the entire data
+                        * transfer we flush the modem input so as to avoid reading
+                        * any modem responses related to misinterpreted Phase C
+                        * data that occurred after the hangup.
+                        */
+                       flushModemInput();
+                   }
                    return (false);
                }
            }
@@ -1960,6 +1972,18 @@ Class1Modem::sendPage(TIFF* tif, Class2Params& params, u_int pageChop, u_int ppm
            while ((r = atResponse(rbuf, getDataTimeout())) == AT_OTHER)
                ;
            rc = (r == AT_OK);
+           if (r == AT_NOCARRIER) {
+               /*
+                * The NO CARRIER result here is not per-spec.  However,
+                * some modems capable of detecting hangup conditions will
+                * use this to indicate a disconnection.  Because we did
+                * not check for modem responses during the entire data
+                * transfer we flush the modem input so as to avoid reading
+                * any modem responses related to misinterpreted Phase C
+                * data that occurred after the hangup.
+                */
+               flushModemInput();
+           }
        }
        if (flowControl == FLOW_XONXOFF)
            setXONXOFF(FLOW_NONE, FLOW_NONE, ACT_DRAIN);