This is an automated email from the ASF dual-hosted git repository.

gkoszyk pushed a commit to branch io_uring_tpc
in repository https://gitbox.apache.org/repos/asf/iggy.git


The following commit(s) were added to refs/heads/io_uring_tpc by this push:
     new 98cf5c59b feat(io_uring): fix tcp tls tests (#2291)
98cf5c59b is described below

commit 98cf5c59b6193504cfadf85e00dd87e0b9337619
Author: Grzegorz Koszyk <[email protected]>
AuthorDate: Fri Oct 24 12:31:07 2025 +0200

    feat(io_uring): fix tcp tls tests (#2291)
---
 core/sdk/src/tcp/tcp_tls_connection_stream.rs |  2 +-
 core/server/src/tcp/tcp_tls_sender.rs         | 36 ++++++++++++++++++++++++---
 2 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/core/sdk/src/tcp/tcp_tls_connection_stream.rs 
b/core/sdk/src/tcp/tcp_tls_connection_stream.rs
index 16d00848a..0f7f48bf6 100644
--- a/core/sdk/src/tcp/tcp_tls_connection_stream.rs
+++ b/core/sdk/src/tcp/tcp_tls_connection_stream.rs
@@ -43,7 +43,7 @@ impl TcpTlsConnectionStream {
 #[async_trait]
 impl ConnectionStream for TcpTlsConnectionStream {
     async fn read(&mut self, buf: &mut [u8]) -> Result<usize, IggyError> {
-        self.stream.read(buf).await.map_err(|error| {
+        self.stream.read_exact(buf).await.map_err(|error| {
             error!(
                 "Failed to read data by client: {} from the TCP TLS 
connection: {error}",
                 self.client_address
diff --git a/core/server/src/tcp/tcp_tls_sender.rs 
b/core/server/src/tcp/tcp_tls_sender.rs
index 3ec45e5b8..28a94c62d 100644
--- a/core/server/src/tcp/tcp_tls_sender.rs
+++ b/core/server/src/tcp/tcp_tls_sender.rs
@@ -38,15 +38,36 @@ impl Sender for TcpTlsSender {
     }
 
     async fn send_empty_ok_response(&mut self) -> Result<(), IggyError> {
-        sender::send_empty_ok_response(&mut self.stream).await
+        sender::send_empty_ok_response(&mut self.stream).await?;
+        self.stream
+            .flush()
+            .await
+            .with_error_context(|e| {
+                format!("failed to flush TCP stream after sending response: 
{e}")
+            })
+            .map_err(|_| IggyError::TcpError)
     }
 
     async fn send_ok_response(&mut self, payload: &[u8]) -> Result<(), 
IggyError> {
-        sender::send_ok_response(&mut self.stream, payload).await
+        sender::send_ok_response(&mut self.stream, payload).await?;
+        self.stream
+            .flush()
+            .await
+            .with_error_context(|e| {
+                format!("failed to flush TCP stream after sending response: 
{e}")
+            })
+            .map_err(|_| IggyError::TcpError)
     }
 
     async fn send_error_response(&mut self, error: IggyError) -> Result<(), 
IggyError> {
-        sender::send_error_response(&mut self.stream, error).await
+        sender::send_error_response(&mut self.stream, error).await?;
+        self.stream
+            .flush()
+            .await
+            .with_error_context(|e| {
+                format!("failed to flush TCP stream after sending response: 
{e}")
+            })
+            .map_err(|_| IggyError::TcpError)
     }
 
     async fn shutdown(&mut self) -> Result<(), ServerError> {
@@ -64,6 +85,13 @@ impl Sender for TcpTlsSender {
         length: &[u8],
         slices: Vec<PooledBuffer>,
     ) -> Result<(), IggyError> {
-        sender::send_ok_response_vectored(&mut self.stream, length, 
slices).await
+        sender::send_ok_response_vectored(&mut self.stream, length, 
slices).await?;
+        self.stream
+            .flush()
+            .await
+            .with_error_context(|e| {
+                format!("failed to flush TCP stream after sending response: 
{e}")
+            })
+            .map_err(|_| IggyError::TcpError)
     }
 }

Reply via email to