Remove useless flush fn on postgres raw conn

This commit is contained in:
Ryan Leckey 2019-08-25 14:55:38 -07:00
parent 37c22eb55d
commit 45f1c02027
5 changed files with 6 additions and 12 deletions

View File

@ -38,7 +38,7 @@ pub async fn establish<'a, 'b: 'a>(
let message = StartupMessage { params };
conn.write(message);
conn.flush().await?;
conn.stream.flush().await?;
while let Some(message) = conn.receive().await? {
match message {
@ -52,7 +52,7 @@ pub async fn establish<'a, 'b: 'a>(
// FIXME: Should error early (before send) if the user did not supply a password
conn.write(PasswordMessage::Cleartext(password));
conn.flush().await?;
conn.stream.flush().await?;
}
Authentication::Md5Password { salt } => {
@ -63,7 +63,7 @@ pub async fn establish<'a, 'b: 'a>(
salt,
});
conn.flush().await?;
conn.stream.flush().await?;
}
auth => {

View File

@ -3,7 +3,7 @@ use crate::{error::Error, postgres::protocol::Message};
use std::io;
pub async fn execute(conn: &mut PostgresRawConnection) -> Result<u64, Error> {
conn.flush().await?;
conn.stream.flush().await?;
let mut rows = 0;

View File

@ -7,7 +7,7 @@ pub fn fetch<'a>(
conn: &'a mut PostgresRawConnection,
) -> impl Stream<Item = Result<PostgresRow, Error>> + 'a {
async_stream::try_stream! {
conn.flush().await?;
conn.stream.flush().await.map_err(Error::Io)?;
while let Some(message) = conn.receive().await? {
match message {

View File

@ -5,7 +5,7 @@ use std::io;
pub async fn fetch_optional<'a>(
conn: &'a mut PostgresRawConnection,
) -> Result<Option<PostgresRow>, Error> {
conn.flush().await?;
conn.stream.flush().await?;
let mut row: Option<PostgresRow> = None;

View File

@ -123,12 +123,6 @@ impl PostgresRawConnection {
pub(super) fn write(&mut self, message: impl Encode) {
message.encode(self.stream.buffer_mut());
}
async fn flush(&mut self) -> Result<(), Error> {
self.stream.flush().await?;
Ok(())
}
}
impl RawConnection for PostgresRawConnection {