Skip to content

Commit

Permalink
istream/Suspend: support buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Aug 16, 2023
1 parent 113e5a1 commit bb83799
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/istream/SuspendIstream.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "ForwardIstream.hxx"
#include "UnusedPtr.hxx"
#include "New.hxx"
#include "Bucket.hxx"
#include "event/FineTimerEvent.hxx"

class SuspendIstream final : public ForwardIstream {
Expand Down Expand Up @@ -41,6 +42,13 @@ class SuspendIstream final : public ForwardIstream {
Schedule();
}

void _FillBucketList(IstreamBucketList &list) override {
if (ready)
ForwardIstream::_FillBucketList(list);
else
list.SetMore();
}

int _AsFd() noexcept override {
return ready ? ForwardIstream::_AsFd() : -1;
}
Expand All @@ -53,7 +61,18 @@ class SuspendIstream final : public ForwardIstream {

void OnTimer() noexcept {
ready = true;
input.Read();

switch (InvokeReady()) {
case IstreamReadyResult::OK:
break;

case IstreamReadyResult::FALLBACK:
input.Read();
break;

case IstreamReadyResult::CLOSED:
break;
}
}
};

Expand Down

0 comments on commit bb83799

Please sign in to comment.