errors
This commit is contained in:
@@ -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,
|
||||
|
@@ -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)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
@@ -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()))]
|
||||
|
@@ -53,7 +53,7 @@ impl DummyNetworkConnection {
|
||||
pub fn descriptor(&self) -> ConnectionDescriptor {
|
||||
self.descriptor.clone()
|
||||
}
|
||||
// pub fn close(&self) -> Result<(), String> {
|
||||
// pub fn close(&self) -> io::Result<()> {
|
||||
// Ok(())
|
||||
// }
|
||||
pub fn send(&self, _message: Vec<u8>) -> io::Result<()> {
|
||||
|
@@ -10,11 +10,9 @@ pub use protocol::*;
|
||||
|
||||
struct NetworkInner {
|
||||
network_manager: NetworkManager,
|
||||
stop_network: Eventual,
|
||||
network_started: bool,
|
||||
network_needs_restart: bool,
|
||||
protocol_config: Option<ProtocolConfig>,
|
||||
//join_handle: TryJoin?
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -27,7 +25,6 @@ impl Network {
|
||||
fn new_inner(network_manager: NetworkManager) -> NetworkInner {
|
||||
NetworkInner {
|
||||
network_manager,
|
||||
stop_network: Eventual::new(),
|
||||
network_started: false,
|
||||
network_needs_restart: false,
|
||||
protocol_config: None, //join_handle: None,
|
||||
@@ -248,7 +245,7 @@ impl Network {
|
||||
f(&[])
|
||||
}
|
||||
|
||||
pub async fn check_interface_addresses(&self) -> Result<bool, String> {
|
||||
pub async fn check_interface_addresses(&self) -> EyreResult<bool> {
|
||||
Ok(false)
|
||||
}
|
||||
|
||||
|
@@ -41,8 +41,8 @@ impl WebsocketNetworkConnection {
|
||||
}
|
||||
|
||||
// #[instrument(level = "trace", err, skip(self))]
|
||||
// pub async fn close(&self) -> Result<(), String> {
|
||||
// self.inner.ws_meta.close().await.map_err(map_to_string).map(drop)
|
||||
// pub async fn close(&self) -> io::Result<()> {
|
||||
// self.inner.ws_meta.close().await.map_err(to_io).map(drop)
|
||||
// }
|
||||
|
||||
#[instrument(level = "trace", err, skip(self, message), fields(message.len = message.len()))]
|
||||
@@ -62,7 +62,7 @@ impl WebsocketNetworkConnection {
|
||||
pub async fn recv(&self) -> io::Result<Vec<u8>> {
|
||||
let out = match SendWrapper::new(self.inner.ws_stream.clone().next()).await {
|
||||
Some(WsMessage::Binary(v)) => v,
|
||||
Some(x) => {
|
||||
Some(_) => {
|
||||
bail_io_error_other!("Unexpected WS message type");
|
||||
}
|
||||
None => {
|
||||
|
Reference in New Issue
Block a user