From e2f517ed3a661921c3bcbc3111001495975f28a0 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Tue, 9 Sep 2003 20:49:38 +0000 Subject: [PATCH] Fixed binkp MB state error --- ChangeLog | 3 +++ mbcico/binkp.c | 20 ++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d3c3b2b..c8a42a4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -37,6 +37,9 @@ v0.37.7 09-Sep-2003 Debug logging is now in a separate file, the normal logging is now only in the normal logfiles. + mbcico: + Fixed MB state error from the previous version. + mbtask: Added support for debug logfile. Dropped the debug switch for mbtask logging, this is now allways on. diff --git a/mbcico/binkp.c b/mbcico/binkp.c index 0e378cf0..dfef81d5 100644 --- a/mbcico/binkp.c +++ b/mbcico/binkp.c @@ -106,7 +106,7 @@ typedef enum {RxWaitFile, RxAcceptFile, RxReceData, RxWriteData, RxEndOfBatch, R typedef enum {TxGetNextFile, TxTryRead, TxReadSend, TxWaitLastAck, TxDone} TxType; typedef enum {InitTransfer, Switch, Receive, Transmit} TransferType; typedef enum {Ok, Failure, Continue} TrType; -typedef enum {No, WeCan, TheyWant, Active} OptionState; +typedef enum {No, WeCan, WeWant, TheyWant, Active} OptionState; static int RxState; /* Receiver state */ static int TxState; /* Transmitter state */ @@ -199,6 +199,8 @@ int binkp(int role) Syslog('+', "Binkp: end transfer rc=%d", rc); closetcp(); + Syslog('b', "2nd batch or not, MB flag =%d", MBflag); + if (MBflag != Active) { /* * In singe batch mode we process filerequests after the batch. @@ -492,8 +494,16 @@ void b_nul(char *msg) Syslog('+', "Binkp: remote has %s mail/files for us", msg+4); else if (strncmp(msg, "OPT ", 4) == 0) { Syslog('+', "Options : %s", msg+4); - if ((strstr(msg, (char *)"MB") != NULL) && (MBflag == WeCan)) - MBflag = TheyWant; + if (strstr(msg, (char *)"MB") != NULL) { + Syslog('b', "Remote requests MB, current state = %d", MBflag); + if (MBflag == WeCan) { /* Answering session and do binkp/1.0 */ + MBflag = TheyWant; + Syslog('b', "MB flag set to TheyWant"); + } else if (MBflag == WeWant) { /* Originating session and do binkp/1.0 */ + MBflag = Active; + Syslog('b', "MB flag set to Active"); + } + } if (strstr(msg, (char *)"CRAM-MD5-") != NULL) { /* No SHA-1 support */ if (CFG.NoMD5) { Syslog('+', "Binkp: Remote supports MD5, but it's turned off here"); @@ -553,8 +563,10 @@ SM_STATE(WaitConn) Syslog('+', "Binkp: node %s", ascfnode(remote->addr, 0x1f)); IsDoing("Connect binkp %s", ascfnode(remote->addr, 0xf)); p = xstrcpy((char *)"OPT"); - if (MBflag == WeCan) + if (MBflag == WeCan) { p = xstrcat(p, (char *)" MB"); + MBflag = WeWant; + } if ((noderecord(remote->addr)) && nodes.CRC32 && !CFG.NoCRC32) p = xstrcat(p, (char *)" CRC"); if (strcmp(p, (char *)"OPT"))