Changelog for HylaFAX
+* fix a few timeouts in faxgetty (11 Mar 2005)
* add support for TIFFTAG_FAXDCS (5 Mar 2005)
* fix batching error in ECM to some receivers (5 Mar 2005)
* modify parsing of Class1EnableV34Cmd (5 Mar 2005)
// look for the last sync flag (possibly the previous one)
// some senders use this as the time to do framing so we must wait longer than T.4 A.3.1 implies
- startTimeout(60000); // just to prevent hanging
+ time_t start = Sys::now();
while (bit != 1 && bit != EOF && !didBlockEnd()) { // flag begins with zero, address begins with one
do {
+ if ((unsigned) Sys::now()-start >= 300) { // 5 minutes of synchronization is too much
+ protoTrace("Timeout waiting for the last synchronization flag");
+ return false;
+ }
if (bit == 0 || ones > 6) ones = 0;
bit = getModemBit(0);
if (bit == 1) ones++;
ones = 0;
bit = getModemBit(0);
}
- stopTimeout("waiting for the last synchronization flag");
// receive the frame, strip stuffed zero-bits, and look for end flag
u_short bitpos = 7;
u_int byte = (bit << bitpos);
bool rcpframe = false;
- time_t start = Sys::now();
+ start = Sys::now();
do {
if ((unsigned) Sys::now()-start >= 3) {
protoTrace("Timeout receiving HDLC frame");
if (didBlockEnd()) return (true); // some erroniously re-use bytes
int c = getLastByte(); // some erroniously re-use bits
- startTimeout(2500); // just to prevent hanging
+ time_t start = Sys::now();
do {
+ if ((unsigned) Sys::now()-start >= 60) { // 60 seconds of garbage after RCP is too much
+ protoTrace("Timeout waiting for DLE+ETX");
+ return false;
+ }
if (c == DLE) {
c = getModemChar(0);
if (c == ETX || c == EOF)
break;
}
} while ((c = getModemChar(0)) != EOF);
- stopTimeout("waiting for DLE+ETX");
if (c == EOF) return (false);
else return (true);
}