Skip to content

Commit

Permalink
istream/Tee: implement the "eof" flag in _ConsumeBucketList()
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Aug 10, 2023
1 parent 77ad787 commit ba4c1c5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/istream/TeeIstream.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ struct TeeIstream final : IstreamSink, DestructAnchor {
*/
size_t bucket_list_size;

bool bucket_more;

/**
* A weak output is one which is closed automatically when all
* "strong" outputs have been closed - it will not keep up the
Expand Down Expand Up @@ -108,6 +110,7 @@ struct TeeIstream final : IstreamSink, DestructAnchor {
}

bucket_list_size = list.SpliceBuffersFrom(std::move(sub));
bucket_more = list.HasMore();

if (!parent.IsSingleOutput())
/* if there are more outputs, they may
Expand All @@ -130,8 +133,10 @@ struct TeeIstream final : IstreamSink, DestructAnchor {
size_t consumed = std::min(nbytes, bucket_list_size);
skip = consumed;

// TODO eof?
return {Istream::Consumed(consumed), false};
return {
Istream::Consumed(consumed),
consumed == bucket_list_size && !bucket_more,
};
}

void _Close() noexcept override;
Expand Down

0 comments on commit ba4c1c5

Please sign in to comment.