diff --git a/include/iscsi-private.h b/include/iscsi-private.h index 85fbc5d..a1a33b9 100644 --- a/include/iscsi-private.h +++ b/include/iscsi-private.h @@ -150,6 +150,10 @@ enum iscsi_opcode { struct iscsi_pdu { struct iscsi_pdu *next; +/* There will not be a response to this pdu, so delete it once it is sent on the wire. Dont put it on the wait-queue */ +#define ISCSI_PDU_DELETE_WHEN_SENT 0x00000001 + uint32_t flags; + uint32_t itt; uint32_t cmdsn; enum iscsi_opcode response_opcode; diff --git a/lib/socket.c b/lib/socket.c index c5a2d19..31bf755 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -292,7 +292,11 @@ iscsi_write_to_socket(struct iscsi_context *iscsi) struct iscsi_pdu *pdu = iscsi->outqueue; SLIST_REMOVE(&iscsi->outqueue, pdu); - SLIST_ADD_END(&iscsi->waitpdu, pdu); + if (pdu->flags & ISCSI_PDU_DELETE_WHEN_SENT) { + iscsi_free_pdu(iscsi, pdu); + } else { + SLIST_ADD_END(&iscsi->waitpdu, pdu); + } } } return 0;