This commit is contained in:
John Smith
2022-07-12 12:45:54 -04:00
parent c9d3f38fa0
commit 886d5bbd7c
17 changed files with 171 additions and 181 deletions

View File

@@ -93,7 +93,7 @@ impl ProtocolNetworkConnection {
}
}
// pub async fn close(&self) -> Result<(), String> {
// pub async fn close(&self) -> io::Result<()> {
// match self {
// Self::Dummy(d) => d.close(),
// Self::RawTcp(t) => t.close().await,

View File

@@ -23,21 +23,19 @@ impl RawTcpNetworkConnection {
}
// #[instrument(level = "trace", err, skip(self))]
// pub async fn close(&mut self) -> Result<(), String> {
// pub async fn close(&mut self) -> io::Result<()> {
// // Make an attempt to flush the stream
// self.stream.clone().close().await.map_err(map_to_string)?;
// self.stream.clone().close().await?;
// // Then shut down the write side of the socket to effect a clean close
// cfg_if! {
// if #[cfg(feature="rt-async-std")] {
// self.tcp_stream
// .shutdown(async_std::net::Shutdown::Write)
// .map_err(map_to_string)
// } else if #[cfg(feature="rt-tokio")] {
// use tokio::io::AsyncWriteExt;
// self.tcp_stream.get_mut()
// .shutdown()
// .await
// .map_err(map_to_string)
// }
// }
// }

View File

@@ -71,13 +71,13 @@ where
}
// #[instrument(level = "trace", err, skip(self))]
// pub async fn close(&self) -> Result<(), String> {
// pub async fn close(&self) -> io::Result<()> {
// // Make an attempt to flush the stream
// self.stream.clone().close().await.map_err(map_to_string)?;
// self.stream.clone().close().await.map_err(to_io)?;
// // Then forcibly close the socket
// self.tcp_stream
// .shutdown(Shutdown::Both)
// .map_err(map_to_string)
// .map_err(to_io)
// }
#[instrument(level = "trace", err, skip(self, message), fields(message.len = message.len()))]