diff --git a/lib/pdu.c b/lib/pdu.c index 4ae3139..b5e57fe 100644 --- a/lib/pdu.c +++ b/lib/pdu.c @@ -59,6 +59,14 @@ iscsi_itt_post_increment(struct iscsi_context *iscsi) { return old_itt; } +void iscsi_dump_pdu_header(struct iscsi_context *iscsi, unsigned char *data) { + char dump[ISCSI_RAW_HEADER_SIZE*3+1]={0}; + int i; + for (i=0;idata[16]); + if (iscsi->log_level > 1) { + iscsi_dump_pdu_header(iscsi, in->data); + } + for (pdu = iscsi->waitpdu; pdu; pdu = pdu->next) { if (pdu->itt == itt) { break; diff --git a/lib/socket.c b/lib/socket.c index b448ff5..c30f862 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -61,13 +61,11 @@ iscsi_add_to_outqueue(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) return; } - /* queue pdus in ascending order of itt. - * ensure that pakets with the same itt are kept in order. - * queue pdus with itt = 0xffffffff (SNACK / DataACK) in order but at head of queue. + /* queue pdus in ascending order of CmdSN. + * ensure that pakets with the same CmdSN are kept in FIFO order. */ do { - if (iscsi_serial32_compare(pdu->itt, current->itt) < 0 - || (pdu->itt == 0xffffffff && current->itt != 0xffffffff)) { + if (iscsi_serial32_compare(pdu->cmdsn, current->cmdsn) < 0) { /* insert PDU before the current */ if (last != NULL) { last->next=pdu;