mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-26 18:36:28 +00:00
Buffer client CopyData messages (#284)
Buffers CopyData messages and removes buffer clone for the sync message
This commit is contained in:
@@ -258,7 +258,7 @@ where
|
||||
res.put_i32(len);
|
||||
res.put_slice(&set_complete[..]);
|
||||
|
||||
write_all_half(stream, res).await?;
|
||||
write_all_half(stream, &res).await?;
|
||||
ready_for_query(stream).await
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ where
|
||||
res.put_i32(error.len() as i32 + 4);
|
||||
res.put(error);
|
||||
|
||||
write_all_half(stream, res).await
|
||||
write_all_half(stream, &res).await
|
||||
}
|
||||
|
||||
pub async fn wrong_password<S>(stream: &mut S, user: &str) -> Result<(), Error>
|
||||
@@ -370,7 +370,7 @@ where
|
||||
// CommandComplete
|
||||
res.put(command_complete("SELECT 1"));
|
||||
|
||||
write_all_half(stream, res).await?;
|
||||
write_all_half(stream, &res).await?;
|
||||
ready_for_query(stream).await
|
||||
}
|
||||
|
||||
@@ -459,11 +459,11 @@ where
|
||||
}
|
||||
|
||||
/// Write all the data in the buffer to the TcpStream, write owned half (see mpsc).
|
||||
pub async fn write_all_half<S>(stream: &mut S, buf: BytesMut) -> Result<(), Error>
|
||||
pub async fn write_all_half<S>(stream: &mut S, buf: &BytesMut) -> Result<(), Error>
|
||||
where
|
||||
S: tokio::io::AsyncWrite + std::marker::Unpin,
|
||||
{
|
||||
match stream.write_all(&buf).await {
|
||||
match stream.write_all(buf).await {
|
||||
Ok(_) => Ok(()),
|
||||
Err(_) => return Err(Error::SocketError(format!("Error writing to socket"))),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user