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> {
|
fn handle_auth_response(self, message: Vec<u8>) -> BoxFuture<Connection, ConnectError> {
|
||||||
self.0.send(message)
|
self.0.send(message)
|
||||||
.and_then(|s| s.flush())
|
|
||||||
.and_then(|s| s.read())
|
.and_then(|s| s.read())
|
||||||
.map_err(ConnectError::Io)
|
.map_err(ConnectError::Io)
|
||||||
.and_then(|(m, s)| {
|
.and_then(|(m, s)| {
|
||||||
@ -277,7 +276,6 @@ impl Connection {
|
|||||||
.map(|()| buf)
|
.map(|()| buf)
|
||||||
.into_future()
|
.into_future()
|
||||||
.and_then(move |buf| self.0.send(buf))
|
.and_then(move |buf| self.0.send(buf))
|
||||||
.and_then(|s| s.flush())
|
|
||||||
.map_err(Error::Io)
|
.map_err(Error::Io)
|
||||||
.and_then(|s| Connection(s).simple_read_rows(vec![]))
|
.and_then(|s| Connection(s).simple_read_rows(vec![]))
|
||||||
.boxed()
|
.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::Require(h) => (true, h),
|
||||||
TlsMode::Prefer(h) => (false, h),
|
TlsMode::Prefer(h) => (false, h),
|
||||||
TlsMode::None => {
|
TlsMode::None => {
|
||||||
|
@ -26,7 +26,7 @@ impl TlsStream for Stream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub trait Handshake: 'static + Sync + Send {
|
pub trait Handshake: 'static + Sync + Send {
|
||||||
fn handshake(&mut self,
|
fn handshake(self: Box<Self>,
|
||||||
host: &str,
|
host: &str,
|
||||||
stream: Stream)
|
stream: Stream)
|
||||||
-> BoxFuture<Box<TlsStream>, Box<Error + Sync + Send>>;
|
-> BoxFuture<Box<TlsStream>, Box<Error + Sync + Send>>;
|
||||||
|
@ -32,7 +32,7 @@ impl From<SslConnector> for OpenSsl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Handshake for OpenSsl {
|
impl Handshake for OpenSsl {
|
||||||
fn handshake(&mut self,
|
fn handshake(self: Box<Self>,
|
||||||
host: &str,
|
host: &str,
|
||||||
stream: Stream)
|
stream: Stream)
|
||||||
-> BoxFuture<Box<TlsStream>, Box<Error + Sync + Send>> {
|
-> BoxFuture<Box<TlsStream>, Box<Error + Sync + Send>> {
|
||||||
|
Loading…
Reference in New Issue
Block a user