Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5bea375

Browse files
committed
Remove the flush step from connect future
The socket's not buffered, so there's no need to do this.
1 parent 7de5ac8 commit 5bea375

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

tokio-postgres/src/proto/connect.rs

+2-22
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::io;
77
use std::net::{SocketAddr, ToSocketAddrs};
88
use std::time::{Duration, Instant};
99
use std::vec;
10-
use tokio_io::io::{flush, read_exact, write_all, Flush, ReadExact, WriteAll};
10+
use tokio_io::io::{read_exact, write_all, ReadExact, WriteAll};
1111
use tokio_tcp::{self, TcpStream};
1212
use tokio_timer::Delay;
1313

@@ -61,20 +61,13 @@ pub enum Connect {
6161
params: ConnectParams,
6262
tls: TlsMode,
6363
},
64-
#[state_machine_future(transitions(FlushingSsl))]
64+
#[state_machine_future(transitions(ReadingSsl))]
6565
SendingSsl {
6666
future: WriteAll<Socket, Vec<u8>>,
6767
params: ConnectParams,
6868
connector: Box<TlsConnect>,
6969
required: bool,
7070
},
71-
#[state_machine_future(transitions(ReadingSsl))]
72-
FlushingSsl {
73-
future: Flush<Socket>,
74-
params: ConnectParams,
75-
connector: Box<TlsConnect>,
76-
required: bool,
77-
},
7871
#[state_machine_future(transitions(ConnectingTls, Ready))]
7972
ReadingSsl {
8073
future: ReadExact<Socket, [u8; 1]>,
@@ -240,19 +233,6 @@ impl PollConnect for Connect {
240233
) -> Poll<AfterSendingSsl, Error> {
241234
let (stream, _) = try_ready_closed!(state.future.poll());
242235
let state = state.take();
243-
transition!(FlushingSsl {
244-
future: flush(stream),
245-
params: state.params,
246-
connector: state.connector,
247-
required: state.required,
248-
})
249-
}
250-
251-
fn poll_flushing_ssl<'a>(
252-
state: &'a mut RentToOwn<'a, FlushingSsl>,
253-
) -> Poll<AfterFlushingSsl, Error> {
254-
let stream = try_ready_closed!(state.future.poll());
255-
let state = state.take();
256236
transition!(ReadingSsl {
257237
future: read_exact(stream, [0]),
258238
params: state.params,

0 commit comments

Comments
 (0)