Fixed binkp MB state error

This commit is contained in:
Michiel Broek 2003-09-09 20:49:38 +00:00
parent ea98670b1e
commit e2f517ed3a
2 changed files with 19 additions and 4 deletions

View File

@ -37,6 +37,9 @@ v0.37.7 09-Sep-2003
Debug logging is now in a separate file, the normal logging is Debug logging is now in a separate file, the normal logging is
now only in the normal logfiles. now only in the normal logfiles.
mbcico:
Fixed MB state error from the previous version.
mbtask: mbtask:
Added support for debug logfile. Dropped the debug switch for Added support for debug logfile. Dropped the debug switch for
mbtask logging, this is now allways on. mbtask logging, this is now allways on.

View File

@ -106,7 +106,7 @@ typedef enum {RxWaitFile, RxAcceptFile, RxReceData, RxWriteData, RxEndOfBatch, R
typedef enum {TxGetNextFile, TxTryRead, TxReadSend, TxWaitLastAck, TxDone} TxType; typedef enum {TxGetNextFile, TxTryRead, TxReadSend, TxWaitLastAck, TxDone} TxType;
typedef enum {InitTransfer, Switch, Receive, Transmit} TransferType; typedef enum {InitTransfer, Switch, Receive, Transmit} TransferType;
typedef enum {Ok, Failure, Continue} TrType; 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 RxState; /* Receiver state */
static int TxState; /* Transmitter state */ static int TxState; /* Transmitter state */
@ -199,6 +199,8 @@ int binkp(int role)
Syslog('+', "Binkp: end transfer rc=%d", rc); Syslog('+', "Binkp: end transfer rc=%d", rc);
closetcp(); closetcp();
Syslog('b', "2nd batch or not, MB flag =%d", MBflag);
if (MBflag != Active) { if (MBflag != Active) {
/* /*
* In singe batch mode we process filerequests after the batch. * 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); Syslog('+', "Binkp: remote has %s mail/files for us", msg+4);
else if (strncmp(msg, "OPT ", 4) == 0) { else if (strncmp(msg, "OPT ", 4) == 0) {
Syslog('+', "Options : %s", msg+4); Syslog('+', "Options : %s", msg+4);
if ((strstr(msg, (char *)"MB") != NULL) && (MBflag == WeCan)) if (strstr(msg, (char *)"MB") != NULL) {
MBflag = TheyWant; 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 (strstr(msg, (char *)"CRAM-MD5-") != NULL) { /* No SHA-1 support */
if (CFG.NoMD5) { if (CFG.NoMD5) {
Syslog('+', "Binkp: Remote supports MD5, but it's turned off here"); 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)); Syslog('+', "Binkp: node %s", ascfnode(remote->addr, 0x1f));
IsDoing("Connect binkp %s", ascfnode(remote->addr, 0xf)); IsDoing("Connect binkp %s", ascfnode(remote->addr, 0xf));
p = xstrcpy((char *)"OPT"); p = xstrcpy((char *)"OPT");
if (MBflag == WeCan) if (MBflag == WeCan) {
p = xstrcat(p, (char *)" MB"); p = xstrcat(p, (char *)" MB");
MBflag = WeWant;
}
if ((noderecord(remote->addr)) && nodes.CRC32 && !CFG.NoCRC32) if ((noderecord(remote->addr)) && nodes.CRC32 && !CFG.NoCRC32)
p = xstrcat(p, (char *)" CRC"); p = xstrcat(p, (char *)" CRC");
if (strcmp(p, (char *)"OPT")) if (strcmp(p, (char *)"OPT"))