AmendHub

Download:

jcs

/

subtext

/

amendments

/

542

binkpc: Bail when receiving an M_SKIP

It's supposed to be non-destructive and we'll retry on the next
connection, though because the file remains in the outbox, we'll
pick it up quite quickly and retry sooner than the poll interval.

jcs made amendment 542 5 months ago
--- binkp.c Tue Nov 14 17:20:46 2023 +++ binkp.c Wed Nov 15 09:23:02 2023 @@ -973,7 +973,7 @@ binkp_deliver_outbox(void) fpb->ioDirID = dir_id; /* * Keep requesting the first item in the directory since we're - * deleting each file as we process it + * deleting or moving each file as we process it. */ fpb->ioFDirIndex = 1; @@ -1003,8 +1003,8 @@ binkp_deliver_outbox(void) logger_printf("[binkp] Sending file %s size %lu", file_name_c, sb.st_size); - len = snprintf(command, sizeof(command), "%s %lu %lu 0", file_name_c, - sb.st_size, MAC_TO_UNIX_TIME(sb.st_mtime)); + len = snprintf(command, sizeof(command), "%s %lu %lu 0", + file_name_c, sb.st_size, MAC_TO_UNIX_TIME(sb.st_ctime)); if (!binkp_send_frame(BINKP_COMMAND_M_FILE, command, len)) goto done; @@ -1050,11 +1050,20 @@ binkp_deliver_outbox(void) logger_printf("[binkp] Connection lost waiting for M_GOT"); goto done; } - + + if (binkpc->cur_frame.type == BINKP_TYPE_COMMAND && + binkpc->cur_frame.command_id == BINKP_COMMAND_M_SKIP) { + logger_printf("[binkp] Received SKIP response " + "to sending file %s, will retry during next connection", + file_name_c); + goto send_eob; + } + if (binkpc->cur_frame.type != BINKP_TYPE_COMMAND || binkpc->cur_frame.command_id != BINKP_COMMAND_M_GOT) { - logger_printf("[binkp] Received unexpected response to " - "sending file"); + logger_printf("[binkp] Received unexpected response " + "(0x%x 0x%x) to sending file, aborting", + binkpc->cur_frame.type, binkpc->cur_frame.command_id); goto done; } @@ -1092,6 +1101,7 @@ try_rename: } } +send_eob: if (!binkp_send_frame(BINKP_COMMAND_M_EOB, "", 0)) logger_printf("[binkp] Failed sending M_EOB");