Write the PDU directly to the socket if the socket is idle.

Signed-off-by: sahlberg <sahlberg@r10-0-1.rocky10.sahlberg>
This commit is contained in:
sahlberg
2025-07-15 19:15:57 +10:00
committed by Ronnie Sahlberg
parent c92e84c9bc
commit a8c3920ab8
2 changed files with 9 additions and 3 deletions

View File

@@ -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 */

View File

@@ -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;
}