pdu: introduce ISCSI_PDU_CORK_WHEN_SENT
Signed-off-by: Peter Lieven <pl@kamp.de>
This commit is contained in:
@@ -80,6 +80,7 @@ struct iscsi_context {
|
||||
|
||||
int fd;
|
||||
int is_connected;
|
||||
int is_corked;
|
||||
|
||||
int tcp_user_timeout;
|
||||
int tcp_keepcnt;
|
||||
@@ -209,6 +210,8 @@ struct iscsi_pdu {
|
||||
* This includes any DATA-OUT PDU as well as all NOPs.
|
||||
*/
|
||||
#define ISCSI_PDU_DROP_ON_RECONNECT 0x00000004
|
||||
/* stop sending after this PDU has been sent */
|
||||
#define ISCSI_PDU_CORK_WHEN_SENT 0x00000008
|
||||
|
||||
uint32_t flags;
|
||||
|
||||
|
||||
10
lib/socket.c
10
lib/socket.c
@@ -611,6 +611,12 @@ iscsi_write_to_socket(struct iscsi_context *iscsi)
|
||||
|
||||
while (iscsi->outqueue != NULL || iscsi->outqueue_current != NULL) {
|
||||
if (iscsi->outqueue_current == NULL) {
|
||||
if (iscsi->is_corked) {
|
||||
/* connection is corked we are not allowed to send
|
||||
* additional PDUs */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (iscsi_serial32_compare(iscsi->outqueue->cmdsn, iscsi->maxcmdsn) > 0
|
||||
&& !(iscsi->outqueue->outdata.data[0] & ISCSI_PDU_IMMEDIATE)) {
|
||||
/* stop sending for non-immediate PDUs. maxcmdsn is reached */
|
||||
@@ -699,10 +705,12 @@ iscsi_write_to_socket(struct iscsi_context *iscsi)
|
||||
if (pdu->payload_written != total) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pdu->flags & ISCSI_PDU_DELETE_WHEN_SENT) {
|
||||
iscsi_free_pdu(iscsi, pdu);
|
||||
}
|
||||
if (pdu->flags & ISCSI_PDU_CORK_WHEN_SENT) {
|
||||
iscsi->is_corked = 1;
|
||||
}
|
||||
iscsi->outqueue_current = NULL;
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user