From 4bbd81a4aa720d309dc1e1913ed73525da4f7aed Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Thu, 12 Feb 2026 21:08:13 +0100 Subject: [PATCH 1/2] feat: let end users reuse single conn async handling logic Users who want to follow the same logic that the library does while handling socket activation themselves could benefit from having this function pub. Signed-off-by: Raito Bezarius --- varlink/src/server_async.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/varlink/src/server_async.rs b/varlink/src/server_async.rs index a670b12..413745a 100644 --- a/varlink/src/server_async.rs +++ b/varlink/src/server_async.rs @@ -421,7 +421,7 @@ pub async fn listen_async, H: AsyncConnectionHandler + 'static>( } /// Handle a single async connection -async fn handle_connection( +pub async fn handle_connection( mut stream: AsyncStream, handler: Arc, ) -> Result<()> { From 649094d952cd3af4f53077abf0335a2f0ed09ba6 Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Thu, 12 Feb 2026 21:08:49 +0100 Subject: [PATCH 2/2] feat: let AsyncStream methods be public End users who are manipulating the stream themselves can benefit from calling these functions themselves and handling the I/O. Signed-off-by: Raito Bezarius --- varlink/src/server_async.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/varlink/src/server_async.rs b/varlink/src/server_async.rs index 413745a..759b247 100644 --- a/varlink/src/server_async.rs +++ b/varlink/src/server_async.rs @@ -215,7 +215,7 @@ pub enum AsyncStream { impl AsyncStream { /// Read data from the stream - async fn read(&mut self, buf: &mut [u8]) -> std::io::Result { + pub async fn read(&mut self, buf: &mut [u8]) -> std::io::Result { match self { AsyncStream::TCP(stream) => stream.read(buf).await, #[cfg(unix)] @@ -224,7 +224,7 @@ impl AsyncStream { } /// Write data to the stream - async fn write_all(&mut self, buf: &[u8]) -> std::io::Result<()> { + pub async fn write_all(&mut self, buf: &[u8]) -> std::io::Result<()> { match self { AsyncStream::TCP(stream) => stream.write_all(buf).await, #[cfg(unix)] @@ -233,7 +233,7 @@ impl AsyncStream { } /// Flush the stream - async fn flush(&mut self) -> std::io::Result<()> { + pub async fn flush(&mut self) -> std::io::Result<()> { match self { AsyncStream::TCP(stream) => stream.flush().await, #[cfg(unix)]