Skip to content

Commit 545ab88

Browse files
Fix the names of the set_blocking functions on HttpStream
They're wrong. I called set_blocking to the function that sets the stream as non-blocking and vice-versa.
1 parent b3b3bde commit 545ab88

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

crates/http/src/stream.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ use std::{
88
use rustls::{ConnectionCommon, SideData};
99

1010
pub trait HttpStream: Read + Write {
11-
fn set_non_blocking(&mut self) -> io::Result<()> {
11+
fn set_blocking(&mut self) -> io::Result<()> {
1212
Ok(())
1313
}
1414

15-
fn set_blocking(&mut self, timeout: Duration) -> io::Result<()> {
15+
fn set_non_blocking(&mut self, timeout: Duration) -> io::Result<()> {
1616
let _ = timeout;
1717
Ok(())
1818
}
@@ -99,11 +99,11 @@ impl<S: HttpStream + 'static> IntoHttpStream for S {
9999
}
100100

101101
impl HttpStream for TcpStream {
102-
fn set_blocking(&mut self, timeout: Duration) -> io::Result<()> {
102+
fn set_non_blocking(&mut self, timeout: Duration) -> io::Result<()> {
103103
self.set_read_timeout(Some(timeout))
104104
}
105105

106-
fn set_non_blocking(&mut self) -> io::Result<()> {
106+
fn set_blocking(&mut self) -> io::Result<()> {
107107
self.set_read_timeout(None)
108108
}
109109
}
@@ -138,11 +138,11 @@ where
138138
SD: SideData,
139139
C: core::ops::DerefMut<Target = ConnectionCommon<SD>>,
140140
{
141-
fn set_non_blocking(&mut self) -> io::Result<()> {
142-
self.sock.set_non_blocking()
141+
fn set_blocking(&mut self) -> io::Result<()> {
142+
self.sock.set_blocking()
143143
}
144144

145-
fn set_blocking(&mut self, timeout: Duration) -> io::Result<()> {
146-
self.sock.set_blocking(timeout)
145+
fn set_non_blocking(&mut self, timeout: Duration) -> io::Result<()> {
146+
self.sock.set_non_blocking(timeout)
147147
}
148148
}

crates/server/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ fn peek_stream(
9999
stream: &mut BufReader<Box<dyn HttpStream>>,
100100
duration: Duration,
101101
) -> io::Result<bool> {
102-
stream.get_mut().set_blocking(duration)?;
102+
stream.get_mut().set_non_blocking(duration)?;
103103
let result = !stream.fill_buf()?.is_empty();
104-
stream.get_mut().set_non_blocking()?;
104+
stream.get_mut().set_blocking()?;
105105
Ok(result)
106106
}
107107

0 commit comments

Comments
 (0)