Consume self in handshake
This commit is contained in:
parent
de097259a1
commit
f754391fe4
@ -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()
|
||||
|
@ -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 => {
|
||||
|
@ -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>>;
|
||||
|
@ -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>> {
|
||||
|
Loading…
Reference in New Issue
Block a user