Fix 0-RTT flush

This commit is contained in:
quininer 2019-11-06 21:43:50 +08:00
parent 3e2c0446a4
commit 872510bd65
2 changed files with 14 additions and 10 deletions

View File

@ -154,7 +154,7 @@ where
// end // end
this.state = TlsState::Stream; this.state = TlsState::Stream;
data.clear(); *data = Vec::new();
stream.as_mut_pin().poll_write(cx, buf) stream.as_mut_pin().poll_write(cx, buf)
} }
_ => stream.as_mut_pin().poll_write(cx, buf), _ => stream.as_mut_pin().poll_write(cx, buf),
@ -171,6 +171,10 @@ where
while stream.session.is_handshaking() { while stream.session.is_handshaking() {
futures::ready!(stream.handshake(cx))?; futures::ready!(stream.handshake(cx))?;
} }
this.state = TlsState::Stream;
let (_, data) = &mut this.early_data;
*data = Vec::new();
} }
stream.as_mut_pin().poll_flush(cx) stream.as_mut_pin().poll_flush(cx)

View File

@ -1,20 +1,20 @@
//! Asynchronous TLS/SSL streams for Tokio using [Rustls](https://github.com/ctz/rustls). //! Asynchronous TLS/SSL streams for Tokio using [Rustls](https://github.com/ctz/rustls).
pub mod client;
mod common; mod common;
pub mod client;
pub mod server; pub mod server;
use common::Stream; use std::{ io, mem };
use futures_core as futures;
use pin_project::{pin_project, project};
use rustls::{ClientConfig, ClientSession, ServerConfig, ServerSession, Session};
use std::future::Future;
use std::pin::Pin; use std::pin::Pin;
use std::sync::Arc; use std::sync::Arc;
use std::task::{Context, Poll}; use std::future::Future;
use std::{io, mem}; use std::task::{ Context, Poll };
use tokio_io::{AsyncRead, AsyncWrite}; use futures_core as futures;
use pin_project::{ pin_project, project };
use tokio_io::{ AsyncRead, AsyncWrite };
use webpki::DNSNameRef; use webpki::DNSNameRef;
use rustls::{ ClientConfig, ClientSession, ServerConfig, ServerSession, Session };
use common::Stream;
pub use rustls; pub use rustls;
pub use webpki; pub use webpki;