1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

apply fix from #2369

This commit is contained in:
Rob Ede
2022-07-24 16:35:00 +01:00
parent e0a88cea8d
commit 8ff489aa90
2 changed files with 15 additions and 8 deletions

View File

@ -976,9 +976,11 @@ where
//
// A Request head too large to parse is only checked on `httparse::Status::Partial`.
if this.payload.is_none() {
// When dispatcher has a payload the responsibility of wake up it would be shift
// to h1::payload::Payload.
match this.payload {
// When dispatcher has a payload the responsibility of wake ups is shifted to
// `h1::payload::Payload` unless the payload is needing a read, in which case it
// might not have access to the waker and could result in the dispatcher
// getting stuck until timeout.
//
// Reason:
// Self wake up when there is payload would waste poll and/or result in
@ -989,7 +991,8 @@ where
// read anymore. At this case read_buf could always remain beyond
// MAX_BUFFER_SIZE and self wake up would be busy poll dispatcher and
// waste resources.
cx.waker().wake_by_ref();
Some(ref p) if p.need_read(cx) != PayloadStatus::Read => {}
_ => cx.waker().wake_by_ref(),
}
return Ok(false);