fix: not write zero
This commit is contained in:
parent
8b8647b43d
commit
681cbe68ca
@ -187,10 +187,8 @@ where IO: AsyncRead + AsyncWrite
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
let mut stream = Stream::new(&mut self.io, &mut self.session);
|
let mut stream = Stream::new(&mut self.io, &mut self.session);
|
||||||
try_nb!(stream.complete_io());
|
try_nb!(stream.complete_io());
|
||||||
}
|
stream.io.shutdown()
|
||||||
self.io.shutdown()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,8 +110,14 @@ impl<'a, IO: AsyncRead + AsyncWrite, S: Session> Write for Stream<'a, IO, S> {
|
|||||||
Err(err) => return Err(err)
|
Err(err) => return Err(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len == 0 && !buf.is_empty() {
|
||||||
|
// not write zero
|
||||||
|
Err(io::ErrorKind::WouldBlock.into())
|
||||||
|
} else {
|
||||||
Ok(len)
|
Ok(len)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn flush(&mut self) -> io::Result<()> {
|
fn flush(&mut self) -> io::Result<()> {
|
||||||
self.session.flush()?;
|
self.session.flush()?;
|
||||||
|
@ -24,12 +24,14 @@ use tokio_io::{ AsyncRead, AsyncWrite, try_nb };
|
|||||||
use common::Stream;
|
use common::Stream;
|
||||||
|
|
||||||
|
|
||||||
|
/// A wrapper around a `rustls::ClientConfig`, providing an async `connect` method.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct TlsConnector {
|
pub struct TlsConnector {
|
||||||
inner: Arc<ClientConfig>,
|
inner: Arc<ClientConfig>,
|
||||||
early_data: bool
|
early_data: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A wrapper around a `rustls::ServerConfig`, providing an async `accept` method.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct TlsAcceptor {
|
pub struct TlsAcceptor {
|
||||||
inner: Arc<ServerConfig>
|
inner: Arc<ServerConfig>
|
||||||
|
@ -130,10 +130,8 @@ where IO: AsyncRead + AsyncWrite,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
let mut stream = Stream::new(&mut self.io, &mut self.session);
|
let mut stream = Stream::new(&mut self.io, &mut self.session);
|
||||||
try_nb!(stream.complete_io());
|
try_nb!(stream.complete_io());
|
||||||
}
|
stream.io.shutdown()
|
||||||
self.io.shutdown()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user