ABP assumes a FIFO channel and only one packet in flight (due to “stop-and-wait” behavior), so the scenario:
so much so that the sender and receiver have completed 2 packets in between and the receiver is expecting the next packet with seq#0, and instead receives the delayed one.
will not happen.
In another word, the invariant is that the sender won’t send packet 0 again until the receiver has acknowledged the previous 0—so the receiver flips its expectation to 1. Any lingering 0 arriving afterwards can only be duplicate, not a legitimate new packet.