From a8c3920ab8590a61a7fd6be08be426ef888f028d Mon Sep 17 00:00:00 2001 From: sahlberg Date: Tue, 15 Jul 2025 19:15:57 +1000 Subject: [PATCH] Write the PDU directly to the socket if the socket is idle. Signed-off-by: sahlberg --- include/iscsi.h | 1 + lib/socket.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/iscsi.h b/include/iscsi.h index bb4dcf3..3a6e360 100644 --- a/include/iscsi.h +++ b/include/iscsi.h @@ -42,6 +42,7 @@ struct scsi_iovec; #define LIBISCSI_FEATURE_IOVECTOR (1) #define LIBISCSI_FEATURE_NOP_COUNTER (1) #define LIBISCSI_FEATURE_ISER (1) +#define LIBISCSI_IMMEDIATE_SOCKET_WRITE (1) #define MAX_STRING_SIZE (255) /* RFC 3720 Section 3.2.6.1 */ diff --git a/lib/socket.c b/lib/socket.c index fa681a5..7c0a169 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -150,15 +150,20 @@ iscsi_add_to_outqueue(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) finished: iscsi_mt_spin_unlock(&iscsi->iscsi_lock); - /* TODO QQQ need to immediately send for the non multithreading case too - * and for the Windows API too */ #if defined(HAVE_MULTITHREADING) && defined(HAVE_PTHREAD) if(iscsi->multithreading_enabled) { if (current == NULL && pdu == iscsi->outqueue) { pthread_kill(iscsi->service_thread, SIGUSR1); } + } else { +#endif + if (iscsi->outqueue == pdu) { + iscsi->drv->service(iscsi, POLLOUT); + } +#if defined(HAVE_MULTITHREADING) && defined(HAVE_PTHREAD) } -#endif +#endif + return; }