bool messageReceived; // expect/don't expect message carrier
bool repeatPhaseB; // return to beginning of Phase B before next page
bool silenceHeard; // indicates whether the last command was +FRS
+ time_t lastMCF; // indicates the time of the last MCF signal
u_int lastPPM; // last PPM during receive
bool sendCFR; // received TCF was not confirmed
u_short ecmBitPos; // bit position to populate on ecmByte
recvdDCN = false; // haven't seen DCN
lastPPM = FCF_DCN; // anything will do
sendCFR = false; // TCF was not received
+ lastMCF = 0; // no MCF heard yet
fxStr nsf;
encodeNSF(nsf, HYLAFAX_VERSION);
startTimeout(7550);
(void) sendFrame((sendERR ? FCF_ERR : FCF_MCF)|FCF_RCVR);
stopTimeout("sending HDLC frame");
+ lastMCF = Sys::now();
} else if (conf.badPageHandling == FaxModem::BADPAGE_RTNSAVE) {
startTimeout(7550);
(void) sendFrame(FCF_RTN|FCF_RCVR);
}
} else {
(void) transmitFrame((sendERR ? FCF_ERR : FCF_MCF)|FCF_RCVR);
+ lastMCF = Sys::now();
}
- if (pageGood)
+ if (pageGood) {
traceFCF("RECV send", sendERR ? FCF_ERR : FCF_MCF);
- else
+ lastMCF = Sys::now();
+ } else
traceFCF("RECV send", FCF_RTN);
}
/*
if (!switchingPause(emsg)) {
return (false);
}
- u_int rtnfcf = conf.badPageHandling == FaxModem::BADPAGE_DCN ? FCF_DCN : FCF_RTN;
- (void) transmitFrame(rtnfcf|FCF_RCVR);
- traceFCF("RECV send", rtnfcf);
- /*
- * Reset the TIFF-related state so that subsequent
- * writes will overwrite the previous data.
- */
- messageReceived = true; // expect DCS next
signalRcvd = 0;
+ if (params.ec == EC_DISABLE && !getRecvEOLCount() && (Sys::now() - lastMCF < 4)) {
+ /*
+ * We last transmitted MCF a very, very short time ago, received no image data
+ * since then, and now we're seeing a PPM again. In non-ECM mode the chances of
+ * this meaning that we simply missed a very short page is extremely remote. It
+ * probably means that the sender did not properly hear our MCF and that we just
+ * need to retransmit it.
+ */
+ (void) transmitFrame(FCF_MCF|FCF_RCVR);
+ traceFCF("RECV send", FCF_MCF);
+ messageReceived = false; // expect Phase C
+ } else {
+ u_int rtnfcf = conf.badPageHandling == FaxModem::BADPAGE_DCN ? FCF_DCN : FCF_RTN;
+ (void) transmitFrame(rtnfcf|FCF_RCVR);
+ traceFCF("RECV send", rtnfcf);
+ /*
+ * Reset the TIFF-related state so that subsequent
+ * writes will overwrite the previous data.
+ */
+ messageReceived = true; // expect DCS next
+ }
}
break;
case FCF_DCN: // DCN