Prepare update to tungstenite 0.20
This commit is contained in:
parent
3f6e4207e9
commit
ab9ea1c9f6
|
@ -41,7 +41,7 @@ futures-io = { version = "0.3", default-features = false, features = ["std"] }
|
|||
pin-project-lite = "0.2"
|
||||
|
||||
[dependencies.tungstenite]
|
||||
version = "0.19"
|
||||
version = "0.20"
|
||||
default-features = false
|
||||
|
||||
[dependencies.async-std]
|
||||
|
|
12
src/lib.rs
12
src/lib.rs
|
@ -334,11 +334,11 @@ where
|
|||
match futures_util::ready!(self.with_context(Some((ContextWaker::Read, cx)), |s| {
|
||||
#[cfg(feature = "verbose-logging")]
|
||||
trace!(
|
||||
"{}:{} Stream.with_context poll_next -> read_message()",
|
||||
"{}:{} Stream.with_context poll_next -> read()",
|
||||
file!(),
|
||||
line!()
|
||||
);
|
||||
cvt(s.read_message())
|
||||
cvt(s.read())
|
||||
})) {
|
||||
Ok(v) => Poll::Ready(Some(Ok(v))),
|
||||
Err(e) => {
|
||||
|
@ -373,7 +373,7 @@ where
|
|||
}
|
||||
|
||||
fn start_send(mut self: Pin<&mut Self>, item: Message) -> Result<(), Self::Error> {
|
||||
match (*self).with_context(None, |s| s.write_message(item)) {
|
||||
match (*self).with_context(None, |s| s.write(item)) {
|
||||
Ok(()) => Ok(()),
|
||||
Err(WsError::Io(err)) if err.kind() == std::io::ErrorKind::WouldBlock => {
|
||||
// the message was accepted and queued
|
||||
|
@ -388,7 +388,7 @@ where
|
|||
}
|
||||
|
||||
fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||
(*self).with_context(Some((ContextWaker::Write, cx)), |s| cvt(s.write_pending())).map(|r| {
|
||||
(*self).with_context(Some((ContextWaker::Write, cx)), |s| cvt(s.flush())).map(|r| {
|
||||
// WebSocket connection has just been closed. Flushing completed, not an error.
|
||||
match r {
|
||||
Err(WsError::ConnectionClosed) => Ok(()),
|
||||
|
@ -399,8 +399,8 @@ where
|
|||
|
||||
fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||
let res = if self.closing {
|
||||
// After queueing it, we call `write_pending` to drive the close handshake to completion.
|
||||
(*self).with_context(Some((ContextWaker::Write, cx)), |s| s.write_pending())
|
||||
// After queueing it, we call `flush` to drive the close handshake to completion.
|
||||
(*self).with_context(Some((ContextWaker::Write, cx)), |s| s.flush())
|
||||
} else {
|
||||
(*self).with_context(Some((ContextWaker::Write, cx)), |s| s.close(None))
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue