]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Bug 543: extend short timeouts on sending HDLC frames
authorLee Howard <faxguy@howardsilvan.com>
Wed, 18 Aug 2004 18:28:16 +0000 (18:28 +0000)
committerLee Howard <faxguy@howardsilvan.com>
Wed, 18 Aug 2004 18:28:16 +0000 (18:28 +0000)
CHANGES
faxd/Class1.c++
faxd/Class1Poll.c++
faxd/Class1Recv.c++
faxd/Class1Send.c++

diff --git a/CHANGES b/CHANGES
index e9566018f6f39f65806c210012328134bc60c334..68d90665abb108310308b3c7f80ef0ee3cf9bcc3 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,7 @@
 
 Changelog for HylaFAX 4.2.1
 
+* extend short send-HDLC timeouts (18 Aug 2004)
 * add a pause after receiving MCF on non-ECM send sessions (18 Aug 2004)
 * fix broken fax polling (17 Aug 2004)
 * add several timing enhancements for stressed servers (16 Aug 2004)
index 7abad680ed4ef4b40cc76fb71c3e61054ce5677b..b97d99493bde93dcd2476890103d709e78721aee 100644 (file)
@@ -1165,7 +1165,7 @@ Class1Modem::sendFrame(u_char fcf, const u_char* code, const fxStr& nsf, bool la
 bool
 Class1Modem::transmitFrame(u_char fcf, bool lastFrame)
 {
-    startTimeout(2550);                        // 3.0 - 15% = 2.55 secs
+    startTimeout(7550);
     bool frameSent =
        (useV34 ? true : atCmd(thCmd, AT_NOTHING, 0)) &&
        (useV34 ? true : atResponse(rbuf, 0) == AT_CONNECT) &&
@@ -1179,10 +1179,10 @@ Class1Modem::transmitFrame(u_char fcf, u_int dcs, u_int xinfo, bool lastFrame)
 {
     /*
      * The T.30 spec says no frame can take more than 3 seconds
-     * (+/- 15%) to transmit.  We take the conservative approach.
-     * and guard against the send exceeding the lower bound.
+     * (+/- 15%) to transmit.  But the DCE can take as much as 5
+     * seconds to respond CONNECT or result OK, per T.31.
      */
-    startTimeout(2550);                        // 3.0 - 15% = 2.55 secs
+    startTimeout(7550);
     bool frameSent =
        (useV34 ? true : atCmd(thCmd, AT_NOTHING, 0)) &&
        (useV34 ? true : atResponse(rbuf, 0) == AT_CONNECT) &&
@@ -1194,7 +1194,7 @@ Class1Modem::transmitFrame(u_char fcf, u_int dcs, u_int xinfo, bool lastFrame)
 bool
 Class1Modem::transmitFrame(u_char fcf, const fxStr& tsi, bool lastFrame)
 {
-    startTimeout(3000);                        // give more time than others
+    startTimeout(7550);
     bool frameSent =
        (useV34 ? true : atCmd(thCmd, AT_NOTHING, 0)) &&
        (useV34 ? true : atResponse(rbuf, 0) == AT_CONNECT) &&
@@ -1206,7 +1206,7 @@ Class1Modem::transmitFrame(u_char fcf, const fxStr& tsi, bool lastFrame)
 bool
 Class1Modem::transmitFrame(u_char fcf, const u_char* code, const fxStr& nsf, bool lastFrame)
 {
-    startTimeout(3000);                        // give more time than others
+    startTimeout(7550);
     bool frameSent =
        (useV34 ? true : atCmd(thCmd, AT_NOTHING, 0)) &&
        (useV34 ? true : atResponse(rbuf, 0) == AT_CONNECT) &&
index 3716ab8c23762a89fb73b63a5e40a8e0205e7ad5..de3c33c8597b402cbf6edb59d0a5d90c007b69e5 100644 (file)
@@ -60,7 +60,7 @@ Class1Modem::pollBegin(const fxStr& cig0,
     pageGood = false;                          // quality of received page
 
     return atCmd(thCmd, AT_NOTHING) &&
-       atResponse(rbuf, 2550) == AT_CONNECT &&
+       atResponse(rbuf, 7550) == AT_CONNECT &&
        recvIdentification(
            (send&DIS_PWD ? FCF_PPW : 0), pwd,
            (send&DIS_SEP ? FCF_SEP : 0), sep,
index a572f72da1afc27538a60cbf94f4564fd15991f2..5278d2d24bd7974dada35e8efe1cc87b48ff6966 100644 (file)
@@ -148,41 +148,41 @@ Class1Modem::recvIdentification(
      * station or (PWD) (SEP) (CIG) DTC when initiating a poll.
      */
     if (f1) {
-       startTimeout(3000);
+       startTimeout(7550);
        framesSent = sendFrame(f1, pwd, false);
        stopTimeout("sending PWD frame");
     } else if (f2) {
-       startTimeout(3000);
+       startTimeout(7550);
        framesSent = sendFrame(f2, addr, false);
        stopTimeout("sending SUB/SEP frame");
     } else if (f3) {
-       startTimeout(3000);
+       startTimeout(7550);
        framesSent = sendFrame(f3, (const u_char*)HYLAFAX_NSF, nsf, false);
        stopTimeout("sending NSF frame");
     } else {
-       startTimeout(3000);
+       startTimeout(7550);
        framesSent = sendFrame(f4, id, false);
        stopTimeout("sending CSI/CIG frame");
     }
     for (;;) {
        if (framesSent) {
            if (f1) {
-               startTimeout(2550);
+               startTimeout(7550);
                framesSent = sendFrame(f2, addr, false);
                stopTimeout("sending SUB/SEP frame");
            }
            if (framesSent && f2) {
-               startTimeout(2550);
+               startTimeout(7550);
                framesSent = sendFrame(f3, (const u_char*)HYLAFAX_NSF, nsf, false);
                stopTimeout("sending NSF frame");
            }
            if (framesSent && f3) {
-               startTimeout(2550);
+               startTimeout(7550);
                framesSent = sendFrame(f4, id, false);
                stopTimeout("sending CSI/CIG frame");
            }
            if (framesSent) {
-               startTimeout(2550);
+               startTimeout(7550);
                framesSent = sendFrame(f5, dics, xinfo);
                stopTimeout("sending DIS/DCS frame");
            }
@@ -444,7 +444,7 @@ Class1Modem::recvPage(TIFF* tif, u_int& ppm, fxStr& emsg, const fxStr& id)
         * The carrier is already raised.  Thus we
         * use sendFrame() instead of transmitFrame().
         */
-       startTimeout(2550);
+       startTimeout(7550);
        (void) sendFrame((sendERR ? FCF_ERR : FCF_MCF)|FCF_RCVR);
        stopTimeout("sending HDLC frame");
     }
index de9f2b7600c224091647a1c7bca1e220def633a4..d64c9f521765dc5a858b0e912f2975c0fded7158 100644 (file)
@@ -519,31 +519,37 @@ Class1Modem::sendTCF(const Class2Params& params, u_int ms)
 bool
 Class1Modem::sendPrologue(u_int dcs, u_int dcs_xinfo, const fxStr& tsi)
 {
+    /*
+     * T.31 8.3.5 requires the DCE to respond CONNECT or result OK within
+     * five seconds or it must result ERROR.  T.30 requires the data of
+     * the HDLC frame to be tranmsitted in 3 s +/- 15%.  Thus, our
+     * timeouts here must be at least 7500 ms and no more than 8500 ms.
+     */
     bool frameSent;
     if (useV34) frameSent = true;
-    else frameSent = (atCmd(thCmd, AT_NOTHING) && atResponse(rbuf, 2550) == AT_CONNECT);
+    else frameSent = (atCmd(thCmd, AT_NOTHING) && atResponse(rbuf, 7550) == AT_CONNECT);
     if (!frameSent)
        return (false);
     if (pwd != fxStr::null) {
-       startTimeout(2550);             // 3.0 - 15% = 2.55 secs
+       startTimeout(7550);
        bool frameSent = sendFrame(FCF_PWD|FCF_SNDR, pwd, false);
        stopTimeout("sending PWD frame");
        if (!frameSent)
            return (false);
     }
     if (sub != fxStr::null) {
-       startTimeout(2550);             // 3.0 - 15% = 2.55 secs
+       startTimeout(7550);
        bool frameSent = sendFrame(FCF_SUB|FCF_SNDR, sub, false);
        stopTimeout("sending SUB frame");
        if (!frameSent)
            return (false);
     }
-    startTimeout(2550);                        // 3.0 - 15% = 2.55 secs
+    startTimeout(7550);
     frameSent = sendFrame(FCF_TSI|FCF_SNDR, tsi, false);
     stopTimeout("sending TSI frame");
     if (!frameSent)
        return (false);
-    startTimeout(2550);                        // 3.0 - 15% = 2.55 secs
+    startTimeout(7550);
     frameSent = sendFrame(FCF_DCS|FCF_SNDR, dcs, dcs_xinfo);
     stopTimeout("sending DCS frame");
     return (frameSent);