I also find this issue when logging all sequence of arrival packets.
I think in segment loop, when sequence of segment is larger next expecting sequence, should not create a gap, need to wait for expecting packet arrive. In many cases, the expecting packet can arrive after a little or packet is retried in miss-packet case. Not need timeout for this because that with last_ack is updated correctly, if last_ack is larger sequence of first segment in segment_list, it certainly has a gap and will release stream.