fix(sessds): defend restartable stream iterator from infinite loop

This commit is contained in:
Andrew Mayorov 2024-07-03 15:18:54 +02:00
parent 947af1faaf
commit 950f4d9483
No known key found for this signature in database
GPG Key ID: 2837C62ACFBFED5D
1 changed files with 5 additions and 2 deletions

View File

@ -136,10 +136,13 @@ next_stream(ItStream0 = #iter{limit = N, filter = Filter, it = It0, it_cont = It
false -> false ->
next_stream(ItStream) next_stream(ItStream)
end; end;
none -> none when It0 =/= ItCont ->
%% Restart the iteration from the beginning: %% Restart the iteration from the beginning:
ItStream = ItStream0#iter{it = ItCont}, ItStream = ItStream0#iter{it = ItCont},
next_stream(ItStream) next_stream(ItStream);
none ->
%% No point in restarting the iteration, `ItCont` is empty:
none
end. end.
is_fetchable(_Comm1, _Comm2, #srs{it_end = end_of_stream}) -> is_fetchable(_Comm1, _Comm2, #srs{it_end = end_of_stream}) ->