Skip to content

Commit 4492f31

Browse files
authored
fix(http1): fix consuming extra CPU from previous change (#3977)
Revert "fix(http1): fix rare missed write wakeup on connections (#3952)" This reverts commit 2377b89.
1 parent dbe6f25 commit 4492f31

File tree

3 files changed

+2
-254
lines changed

3 files changed

+2
-254
lines changed

Cargo.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,6 @@ name = "integration"
239239
path = "tests/integration.rs"
240240
required-features = ["full"]
241241

242-
[[test]]
243-
name = "ready_stream"
244-
path = "tests/ready_stream.rs"
245-
required-features = ["full"]
246-
247242
[[test]]
248243
name = "server"
249244
path = "tests/server.rs"

src/proto/h1/dispatch.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,8 @@ where
171171
for _ in 0..16 {
172172
let _ = self.poll_read(cx)?;
173173
let _ = self.poll_write(cx)?;
174-
let conn_ready = self.poll_flush(cx)?.is_ready();
174+
let _ = self.poll_flush(cx)?;
175175

176-
// If we can write more body and the connection is ready, we should
177-
// write again. If we return `Ready(Ok(())` here, we will yield
178-
// without a guaranteed wakeup from the write side of the connection.
179-
// This would lead to a deadlock if we also don't expect reads.
180-
let wants_write_again = self.can_write_again() && conn_ready;
181176
// This could happen if reading paused before blocking on IO,
182177
// such as getting to the end of a framed message, but then
183178
// writing/flushing set the state back to Init. In that case,
@@ -186,10 +181,7 @@ where
186181
//
187182
// Using this instead of task::current() and notify() inside
188183
// the Conn is noticeably faster in pipelined benchmarks.
189-
let wants_read_again = self.conn.wants_read_again();
190-
// If we cannot write or read again, we yield and rely on the
191-
// wakeup from the connection futures.
192-
if !(wants_write_again || wants_read_again) {
184+
if !self.conn.wants_read_again() {
193185
//break;
194186
return Poll::Ready(Ok(()));
195187
}
@@ -441,11 +433,6 @@ where
441433
self.conn.close_write();
442434
}
443435

444-
/// If there is pending data in body_rx, we can make progress writing if the connection is ready.
445-
fn can_write_again(&mut self) -> bool {
446-
self.body_rx.is_some()
447-
}
448-
449436
fn is_done(&self) -> bool {
450437
if self.is_closing {
451438
return true;

tests/ready_stream.rs

Lines changed: 0 additions & 234 deletions
This file was deleted.

0 commit comments

Comments
 (0)