@@ -1178,7 +1178,7 @@ kj::Promise<void> ReadableSourceKjAdapter::pumpToImpl(
11781178 // to something else (e.g. Done, Canceling, Canceled), we discard the leftover.
11791179 KJ_IF_SOME (leftOver, context->maybeLeftOver ) {
11801180 if (activePtr->state .is <Active::Idle>()) {
1181- activePtr->state = kj::mv (leftOver);
1181+ activePtr->state . transitionTo <Active::Readable>( kj::mv (leftOver) );
11821182 }
11831183 }
11841184 return context->totalRead ;
@@ -1306,14 +1306,14 @@ kj::Promise<void> ReadableSourceKjAdapter::pumpToImpl(
13061306 // We must do this BEFORE starting the next read so that active->state is Idle
13071307 // when the next read's promise continuation tries to save its leftover.
13081308 kj::Maybe<Active::Readable> maybeLeftover;
1309- KJ_IF_SOME (readable, active->state .tryGet <Active::Readable>()) {
1309+ KJ_IF_SOME (readable, active->state .tryGetUnsafe <Active::Readable>()) {
13101310 maybeLeftover = kj::mv (readable);
13111311 }
13121312
13131313 // Start working on the next read. At this point, if there was leftover, we've
13141314 // moved it to maybeLeftover, so the next read can safely set its leftover
13151315 // to active->state when it completes.
1316- active->state .init <Active::Idle>();
1316+ active->state .transitionTo <Active::Idle>();
13171317 readPromise = pumpReadImpl (*active, buffers[currentReadBuf], minBytes, minReadPolicy);
13181318
13191319 {
0 commit comments