Change EOB handling again....

This commit is contained in:
Michiel Broek 2004-01-08 20:40:17 +00:00
parent 14819bdd72
commit ce7cfbbc72

View File

@ -823,7 +823,7 @@ int file_transfer(void)
TrType Trc = Ok; TrType Trc = Ok;
for (;;) { for (;;) {
// Syslog('B', "Binkp: FileTransfer state %s", ftstate[bp.FtState]); Syslog('B', "Binkp: FileTransfer state %s", ftstate[bp.FtState]);
switch (bp.FtState) { switch (bp.FtState) {
case InitTransfer: binkp_settimer(BINKP_TIMEOUT); case InitTransfer: binkp_settimer(BINKP_TIMEOUT);
bp.RxState = RxWaitF; bp.RxState = RxWaitF;
@ -885,7 +885,10 @@ int file_transfer(void)
case Receive: Trc = binkp_receiver(); case Receive: Trc = binkp_receiver();
if (Trc == Ok) { if (Trc == Ok) {
binkp_settimer(BINKP_TIMEOUT); binkp_settimer(BINKP_TIMEOUT);
bp.FtState = Switch; if (bp.local_EOB && bp.remote_EOB)
bp.FtState = Transmit;
else
bp.FtState = Switch;
} else if (Trc == Failure) { } else if (Trc == Failure) {
Syslog('+', "Binkp: receiver failure"); Syslog('+', "Binkp: receiver failure");
bp.rc = 1; bp.rc = 1;
@ -962,19 +965,25 @@ TrType binkp_receiver(void)
} else if (bcmd == MM_EOB) { } else if (bcmd == MM_EOB) {
Syslog('+', "Binkp: rcvd M_EOB"); Syslog('+', "Binkp: rcvd M_EOB");
if ((bp.Major == 1) && (bp.Minor != 0)) { if ((bp.Major == 1) && (bp.Minor != 0)) {
Syslog('b', "Binkp: 1.1 mode and got M_EOB"); Syslog('b', "Binkp: 1.1 check local_EOB=%s remote_EOB=%s messages=%d",
if (bp.local_EOB && bp.remote_EOB && (bp.messages < 3)) { bp.local_EOB?"True":"False", bp.remote_EOB?"True":"False", bp.messages);
Syslog('b', "Binkp: receiver detected end of session, stay in RxWaitF"); if (bp.local_EOB && bp.remote_EOB) {
return Ok; Syslog('b', "Binkp: receiver detects both sides in EOB state");
if (bp.messages < 3) {
Syslog('b', "Binkp: receiver detected end of session, stay in RxWaitF");
return Ok;
} else {
bp.batchnr++;
bp.local_EOB = FALSE;
bp.remote_EOB = FALSE;
bp.messages = 0;
bp.TxState = TxGNF;
bp.RxState = RxWaitF;
Syslog('+', "Binkp: receiver starts batch %d", bp.batchnr + 1);
binkp_clear_filelist();
return Ok;
}
} else { } else {
bp.batchnr++;
bp.local_EOB = FALSE;
bp.remote_EOB = FALSE;
bp.messages = 0;
bp.TxState = TxGNF;
bp.RxState = RxWaitF;
Syslog('+', "Binkp: receiver starts batch %d", bp.batchnr + 1);
binkp_clear_filelist();
return Ok; return Ok;
} }
} else { } else {