Use Vec instead of BytesMut

There doesn't seem to be any particular advantage to using BytesMut here.
This commit is contained in:
Dirkjan Ochtman 2021-12-01 13:28:02 +01:00 committed by masalachai
parent f30015ad06
commit 59151df029
2 changed files with 2 additions and 6 deletions

View File

@ -11,7 +11,6 @@ repository = "https://github.com/masalachai/epp-client"
[dependencies]
epp-client-macros = { version = "0.1", path = "../epp-client-macros" }
bytes = "1"
chrono = "0.4"
env_logger = "0.9"
log = "0.4"

View File

@ -1,6 +1,5 @@
//! Manages registry connections and reading/writing to them
use bytes::BytesMut;
use rustls::{OwnedTrustAnchor, RootCertStore};
use std::convert::TryInto;
use std::sync::Arc;
@ -66,7 +65,7 @@ impl EppConnection {
let message_size = buf_size - 4;
debug!("{}: Response buffer size: {}", self.registry, message_size);
let mut buf = BytesMut::with_capacity(4096);
let mut buf = Vec::with_capacity(4096);
let mut read_buf = vec![0u8; 4096];
let mut read_size: usize = 0;
@ -86,9 +85,7 @@ impl EppConnection {
}
}
let data = buf.to_vec();
Ok(data)
Ok(buf)
}
/// Receives response from the socket and converts it into an EPP XML string