Buffer client CopyData messages (#284)

Buffers CopyData messages and removes buffer clone for the sync message
This commit is contained in:
zainkabani
2023-01-17 20:39:55 -05:00
committed by GitHub
parent 7894bba59b
commit 85ac3ef9a5
4 changed files with 44 additions and 34 deletions

View File

@@ -381,7 +381,7 @@ impl Server {
}
/// Send messages to the server from the client.
pub async fn send(&mut self, messages: BytesMut) -> Result<(), Error> {
pub async fn send(&mut self, messages: &BytesMut) -> Result<(), Error> {
self.stats.data_sent(messages.len(), self.server_id);
match write_all_half(&mut self.write, messages).await {
@@ -593,7 +593,7 @@ impl Server {
pub async fn query(&mut self, query: &str) -> Result<(), Error> {
let query = simple_query(query);
self.send(query).await?;
self.send(&query).await?;
loop {
let _ = self.recv().await?;