Hylafax Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

[hylafax-users] Possible Class2 RCV Bug and Proposed Fix



Dear Users,

There seems to be a coding error when receiving and unexpected +FHNG 
during receiving with a class 2 modem. The method Class2Modem::waitFor 
returns 'true' when receiving a +FHNG which seems to confuse the logic in 
Class2Modem::recvPage into thinking it got a "+FET" command and then 
times out waiting for the "OK" (which was already taken up by waitFor()). 
I believe the solution is for Class2Modem::waitFor() to return false on 
receiving a +FHNG. I also believe that the error message that is 
generated when an unexpected +FHNG is received is erroneous, you get the 
message: "Normal and proper end of connection", which make you believe 
everthing is OK rather than an error occurs. My proposed changes are:

In faxd/Class2.c++,

Change error message for unexpect hangup;

static struct HangupCode {
    const char*	code[3];	// from 2388/89, 2388/90, 2388-A, and 2388-B
    const char*	message;	// what code means
} hangupCodes[] = {
// Call placement and termination
// - old message
//    {{  "0",  "0",  "0" }, "Normal and proper end of connection" },
// - new message and +FHNG when unexpected is an error
    {{  "0",  "0",  "0" }, "Unexpected end of connection" },


Also In faxd/Class2.c++,

Change waitFor() to return error on unexpected +FHNG from modem:

bool
Class2Modem::waitFor(ATResponse wanted, long ms)
{
    for (;;) {
	ATResponse response = atResponse(rbuf, ms);
	if (response == wanted)
	    return (true);
	switch (response) {
	case AT_TIMEOUT:
	case AT_EMPTYLINE:
	case AT_ERROR:
	case AT_NOCARRIER:
	case AT_NODIALTONE:
	case AT_NOANSWER:
	case AT_RING:
	    modemTrace("MODEM %s", ATresponses[response]);
	    return (false);
	case AT_FHNG:
	    // return hangup status, but try to wait for requested response
	    { char buf[1024]; (void) atResponse(buf, 2*1000); }
	    return(false);		// a hang-up when not expected is always an error
// old code returned true if +FHNG did not give error status
//	    return (isNormalHangup());
	}
    }
}

Here is the class 2 modem receive log that caused the discovery:

....
Dec 19 18:00:48.70: [  279]: RECV: begin page
Dec 19 18:00:48.70: [  279]: RECV: send trigger 022
Dec 19 18:00:48.70: [  279]: <-- data [1]
Dec 19 18:01:07.70: [  279]: RECV: 1070 total lines, 0 bad lines, 0 
consecutive bad lines
Dec 19 18:01:07.71: [  279]: --> [17:+FPTS: 1,2219,0,0]
Dec 19 18:01:09.12: [  279]: --> [7:+FET: 0]
Dec 19 18:01:09.12: [  279]: RECV recv MPS (more pages, same document)
Dec 19 18:01:09.12: [  279]: --> [2:OK]
Dec 19 18:01:09.16: [  279]: RECV send MCF (message confirmation)
Dec 19 18:01:09.16: [  279]: RECV FAX (00002645): from XXXXXXXXXXX, page 
4 in 0:23, INF, 3.85 line/mm, 1-D MR, 14400 bit/s
Dec 19 18:01:09.16: [  279]: <-- [7:AT+FDR\r]
Dec 19 18:01:11.48: [  279]: --> [7:CONNECT]
Dec 19 18:01:11.48: [  279]: RECV: begin page
Dec 19 18:01:11.48: [  279]: RECV: send trigger 022
Dec 19 18:01:11.49: [  279]: <-- data [1]
Dec 19 18:01:11.82: [  279]: RECV: 0 total lines, 0 bad lines, 0 
consecutive bad lines
Dec 19 18:01:11.82: [  279]: --> [17:+FPTS: 2,2219,0,0]
Dec 19 18:01:13.15: [  279]: --> [8:+FHNG: 0]
Dec 19 18:01:13.15: [  279]: REMOTE HANGUP: Normal and proper end of 
connection (code 0)
Dec 19 18:01:14.60: [  279]: --> [2:OK]
Dec 19 18:01:14.60: [  279]: RECV recv MPS (more pages, same document)
Dec 19 18:01:44.60: [  279]: MODEM <Timeout>
Dec 19 18:01:44.60: [  279]: RECV FAX (00002645): recvq/fax02586.tif from 
XXXXXXXXXXX, route to <unspecified>, 4 pages in 2:07
Dec 19 18:01:44.60: [  279]: RECV FAX: Normal and proper end of connection
Dec 19 18:01:44.60: [  279]: RECV FAX (00002645): session with 
XXXXXXXXXXX terminated abnormally: Normal and proper end of connection
Dec 19 18:01:44.60: [  279]: RECV FAX: bin/faxrcvd "recvq/fax02586.tif" 
"cu.modem" "00002645" "Normal and proper end of connection" "" "" 
"XXXXXXXXXXX"
Dec 19 18:01:44.72: [  279]: RECV FAX: end
Dec 19 18:01:44.72: [  279]: SESSION END


What do you think ?

Regards,

Chris

____________________ HylaFAX(tm) Users Mailing List _______________________
  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
 On UNIX: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null
  *To learn about commercial HylaFAX(tm) support, mail sales@hylafax.org.*



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services