Consume self in handshake

This commit is contained in:
Steven Fackler 2016-12-24 12:41:34 -05:00
parent de097259a1
commit f754391fe4
4 changed files with 3 additions and 5 deletions

View File

@ -238,7 +238,6 @@ impl Connection {
fn handle_auth_response(self, message: Vec<u8>) -> BoxFuture<Connection, ConnectError> {
self.0.send(message)
.and_then(|s| s.flush())
.and_then(|s| s.read())
.map_err(ConnectError::Io)
.and_then(|(m, s)| {
@ -277,7 +276,6 @@ impl Connection {
.map(|()| buf)
.into_future()
.and_then(move |buf| self.0.send(buf))
.and_then(|s| s.flush())
.map_err(Error::Io)
.and_then(|s| Connection(s).simple_read_rows(vec![]))
.boxed()

View File

@ -34,7 +34,7 @@ pub fn connect(host: Host,
}
};
let (required, mut handshaker) = match tls_mode {
let (required, handshaker) = match tls_mode {
TlsMode::Require(h) => (true, h),
TlsMode::Prefer(h) => (false, h),
TlsMode::None => {

View File

@ -26,7 +26,7 @@ impl TlsStream for Stream {
}
pub trait Handshake: 'static + Sync + Send {
fn handshake(&mut self,
fn handshake(self: Box<Self>,
host: &str,
stream: Stream)
-> BoxFuture<Box<TlsStream>, Box<Error + Sync + Send>>;

View File

@ -32,7 +32,7 @@ impl From<SslConnector> for OpenSsl {
}
impl Handshake for OpenSsl {
fn handshake(&mut self,
fn handshake(self: Box<Self>,
host: &str,
stream: Stream)
-> BoxFuture<Box<TlsStream>, Box<Error + Sync + Send>> {