[pbs-devel] [PATCH proxmox 2/2] proxmox-async: remove proxmox-sys dependency

Dominik Csapak d.csapak at proxmox.com
Fri Feb 18 13:48:49 CET 2022


by replacing the two uses of io_format_err and io_err_other

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 proxmox-async/Cargo.toml                     |  1 -
 proxmox-async/src/io/async_channel_writer.rs | 16 ++++++++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/proxmox-async/Cargo.toml b/proxmox-async/Cargo.toml
index c7f78cc..c4936ee 100644
--- a/proxmox-async/Cargo.toml
+++ b/proxmox-async/Cargo.toml
@@ -15,7 +15,6 @@ lazy_static = "1.4"
 pin-utils = "0.1.0"
 tokio = { version = "1.0", features = [ "net", "rt", "rt-multi-thread", "sync"] }
 
-proxmox-sys = { path = "../proxmox-sys", version = "0.2.0" }
 proxmox-io = { path = "../proxmox-io", version = "1", features = [ "tokio" ] }
 
 [dev-dependencies]
diff --git a/proxmox-async/src/io/async_channel_writer.rs b/proxmox-async/src/io/async_channel_writer.rs
index f63648a..cec1fb6 100644
--- a/proxmox-async/src/io/async_channel_writer.rs
+++ b/proxmox-async/src/io/async_channel_writer.rs
@@ -12,8 +12,6 @@ use tokio::io::AsyncWrite;
 use tokio::sync::mpsc::Sender;
 
 use proxmox_io::ByteBuffer;
-use proxmox_sys::error::io_err_other;
-use proxmox_sys::io_format_err;
 
 /// Wrapper around tokio::sync::mpsc::Sender, which implements Write
 pub struct AsyncChannelWriter {
@@ -63,7 +61,12 @@ impl AsyncChannelWriter {
 
                     let sender = match self.sender.take() {
                         Some(sender) => sender,
-                        None => return Poll::Ready(Err(io_err_other("no sender"))),
+                        None => {
+                            return Poll::Ready(Err(std::io::Error::new(
+                                std::io::ErrorKind::Other,
+                                "no sender",
+                            )))
+                        }
                     };
 
                     let data = self.buf.remove_data(self.buf.len()).to_vec();
@@ -72,7 +75,12 @@ impl AsyncChannelWriter {
                             .send(Ok(data))
                             .await
                             .map(move |_| sender)
-                            .map_err(|err| io_format_err!("could not send: {}", err))
+                            .map_err(|err| {
+                                std::io::Error::new(
+                                    std::io::ErrorKind::Other,
+                                    format!("could not send: {}", err),
+                                )
+                            })
                     };
 
                     self.state = WriterState::Sending(future.boxed());
-- 
2.30.2






More information about the pbs-devel mailing list