Skip to content

Commit 5b04594

Browse files
committed
Rename handshake to connect_raw
1 parent 3a01c8c commit 5b04594

File tree

8 files changed

+25
-25
lines changed

8 files changed

+25
-25
lines changed

tokio-postgres-native-tls/src/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ where
1717

1818
let handshake = TcpStream::connect(&"127.0.0.1:5433".parse().unwrap())
1919
.map_err(|e| panic!("{}", e))
20-
.and_then(|s| builder.handshake(s, tls));
20+
.and_then(|s| builder.connect_raw(s, tls));
2121
let (mut client, connection) = runtime.block_on(handshake).unwrap();
2222
let connection = connection.map_err(|e| panic!("{}", e));
2323
runtime.spawn(connection);

tokio-postgres-openssl/src/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ where
1717

1818
let handshake = TcpStream::connect(&"127.0.0.1:5433".parse().unwrap())
1919
.map_err(|e| panic!("{}", e))
20-
.and_then(|s| builder.handshake(s, tls));
20+
.and_then(|s| builder.connect_raw(s, tls));
2121
let (mut client, connection) = runtime.block_on(handshake).unwrap();
2222
let connection = connection.map_err(|e| panic!("{}", e));
2323
runtime.spawn(connection);

tokio-postgres/src/config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ use tokio_io::{AsyncRead, AsyncWrite};
1717

1818
#[cfg(feature = "runtime")]
1919
use crate::proto::ConnectFuture;
20-
use crate::proto::HandshakeFuture;
20+
use crate::proto::ConnectRawFuture;
2121
#[cfg(feature = "runtime")]
2222
use crate::{Connect, MakeTlsMode, Socket};
23-
use crate::{Error, Handshake, TlsMode};
23+
use crate::{ConnectRaw, Error, TlsMode};
2424

2525
/// Properties required of a database.
2626
#[cfg(feature = "runtime")]
@@ -400,12 +400,12 @@ impl Config {
400400
/// Connects to a PostgreSQL database over an arbitrary stream.
401401
///
402402
/// All of the settings other than `user`, `password`, `dbname`, `options`, and `application` name are ignored.
403-
pub fn handshake<S, T>(&self, stream: S, tls_mode: T) -> Handshake<S, T>
403+
pub fn connect_raw<S, T>(&self, stream: S, tls_mode: T) -> ConnectRaw<S, T>
404404
where
405405
S: AsyncRead + AsyncWrite,
406406
T: TlsMode<S>,
407407
{
408-
Handshake(HandshakeFuture::new(stream, tls_mode, self.clone(), None))
408+
ConnectRaw(ConnectRawFuture::new(stream, tls_mode, self.clone(), None))
409409
}
410410
}
411411

tokio-postgres/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,12 +377,12 @@ where
377377
}
378378

379379
#[must_use = "futures do nothing unless polled"]
380-
pub struct Handshake<S, T>(proto::HandshakeFuture<S, T>)
380+
pub struct ConnectRaw<S, T>(proto::ConnectRawFuture<S, T>)
381381
where
382382
S: AsyncRead + AsyncWrite,
383383
T: TlsMode<S>;
384384

385-
impl<S, T> Future for Handshake<S, T>
385+
impl<S, T> Future for ConnectRaw<S, T>
386386
where
387387
S: AsyncRead + AsyncWrite,
388388
T: TlsMode<S>,

tokio-postgres/src/proto/connect_once.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use futures::{try_ready, Async, Future, Poll, Stream};
44
use state_machine_future::{transition, RentToOwn, StateMachineFuture};
55
use std::io;
66

7-
use crate::proto::{Client, ConnectSocketFuture, Connection, HandshakeFuture, SimpleQueryStream};
7+
use crate::proto::{Client, ConnectRawFuture, ConnectSocketFuture, Connection, SimpleQueryStream};
88
use crate::{Config, Error, Socket, TargetSessionAttrs, TlsMode};
99

1010
#[derive(StateMachineFuture)]
@@ -18,16 +18,16 @@ where
1818
tls_mode: T,
1919
config: Config,
2020
},
21-
#[state_machine_future(transitions(Handshaking))]
21+
#[state_machine_future(transitions(ConnectingRaw))]
2222
ConnectingSocket {
2323
future: ConnectSocketFuture,
2424
idx: usize,
2525
tls_mode: T,
2626
config: Config,
2727
},
2828
#[state_machine_future(transitions(CheckingSessionAttrs, Finished))]
29-
Handshaking {
30-
future: HandshakeFuture<Socket, T>,
29+
ConnectingRaw {
30+
future: ConnectRawFuture<Socket, T>,
3131
target_session_attrs: TargetSessionAttrs,
3232
},
3333
#[state_machine_future(transitions(Finished))]
@@ -63,15 +63,15 @@ where
6363
let socket = try_ready!(state.future.poll());
6464
let state = state.take();
6565

66-
transition!(Handshaking {
66+
transition!(ConnectingRaw {
6767
target_session_attrs: state.config.0.target_session_attrs,
68-
future: HandshakeFuture::new(socket, state.tls_mode, state.config, Some(state.idx)),
68+
future: ConnectRawFuture::new(socket, state.tls_mode, state.config, Some(state.idx)),
6969
})
7070
}
7171

72-
fn poll_handshaking<'a>(
73-
state: &'a mut RentToOwn<'a, Handshaking<T>>,
74-
) -> Poll<AfterHandshaking<T>, Error> {
72+
fn poll_connecting_raw<'a>(
73+
state: &'a mut RentToOwn<'a, ConnectingRaw<T>>,
74+
) -> Poll<AfterConnectingRaw<T>, Error> {
7575
let (client, connection) = try_ready!(state.future.poll());
7676

7777
if let TargetSessionAttrs::ReadWrite = state.target_session_attrs {

tokio-postgres/src/proto/handshake.rs renamed to tokio-postgres/src/proto/connect_raw.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::proto::{Client, Connection, PostgresCodec, TlsFuture};
1515
use crate::{ChannelBinding, Config, Error, TlsMode};
1616

1717
#[derive(StateMachineFuture)]
18-
pub enum Handshake<S, T>
18+
pub enum ConnectRaw<S, T>
1919
where
2020
S: AsyncRead + AsyncWrite,
2121
T: TlsMode<S>,
@@ -81,7 +81,7 @@ where
8181
Failed(Error),
8282
}
8383

84-
impl<S, T> PollHandshake<S, T> for Handshake<S, T>
84+
impl<S, T> PollConnectRaw<S, T> for ConnectRaw<S, T>
8585
where
8686
S: AsyncRead + AsyncWrite,
8787
T: TlsMode<S>,
@@ -374,7 +374,7 @@ where
374374
}
375375
}
376376

377-
impl<S, T> HandshakeFuture<S, T>
377+
impl<S, T> ConnectRawFuture<S, T>
378378
where
379379
S: AsyncRead + AsyncWrite,
380380
T: TlsMode<S>,
@@ -384,7 +384,7 @@ where
384384
tls_mode: T,
385385
config: Config,
386386
idx: Option<usize>,
387-
) -> HandshakeFuture<S, T> {
388-
Handshake::start(TlsFuture::new(stream, tls_mode), config, idx)
387+
) -> ConnectRawFuture<S, T> {
388+
ConnectRaw::start(TlsFuture::new(stream, tls_mode), config, idx)
389389
}
390390
}

tokio-postgres/src/proto/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ mod codec;
2828
mod connect;
2929
#[cfg(feature = "runtime")]
3030
mod connect_once;
31+
mod connect_raw;
3132
#[cfg(feature = "runtime")]
3233
mod connect_socket;
3334
mod connection;
3435
mod copy_in;
3536
mod copy_out;
3637
mod execute;
37-
mod handshake;
3838
mod idle;
3939
mod portal;
4040
mod prepare;
@@ -57,13 +57,13 @@ pub use crate::proto::codec::PostgresCodec;
5757
pub use crate::proto::connect::ConnectFuture;
5858
#[cfg(feature = "runtime")]
5959
pub use crate::proto::connect_once::ConnectOnceFuture;
60+
pub use crate::proto::connect_raw::ConnectRawFuture;
6061
#[cfg(feature = "runtime")]
6162
pub use crate::proto::connect_socket::ConnectSocketFuture;
6263
pub use crate::proto::connection::Connection;
6364
pub use crate::proto::copy_in::CopyInFuture;
6465
pub use crate::proto::copy_out::CopyOutStream;
6566
pub use crate::proto::execute::ExecuteFuture;
66-
pub use crate::proto::handshake::HandshakeFuture;
6767
pub use crate::proto::portal::Portal;
6868
pub use crate::proto::prepare::PrepareFuture;
6969
pub use crate::proto::query::QueryStream;

tokio-postgres/tests/test/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn connect(
2525
let builder = s.parse::<tokio_postgres::Config>().unwrap();
2626
TcpStream::connect(&"127.0.0.1:5433".parse().unwrap())
2727
.map_err(|e| panic!("{}", e))
28-
.and_then(move |s| builder.handshake(s, NoTls))
28+
.and_then(move |s| builder.connect_raw(s, NoTls))
2929
}
3030

3131
fn smoke_test(s: &str) {

0 commit comments

Comments
 (0)