socket: do not stop sending for immediate PDUs

Signed-off-by: Peter Lieven <pl@kamp.de>
pdu: introduce ISCSI_PDU_CORK_WHEN_SENT

Signed-off-by: Peter Lieven <pl@kamp.de>
logout: cork socket after logout has been sent

Signed-off-by: Peter Lieven <pl@kamp.de>
logout: allow additional PDU flags to be passed internally

Signed-off-by: Peter Lieven <pl@kamp.de>
pdu: introduce ISCSI_PDU_URGENT_DELIVERY

Signed-off-by: Peter Lieven <pl@kamp.de>
pdu: handle async target requests logout events

Signed-off-by: Peter Lieven <pl@kamp.de>
pdu: catch rejected packets while target waits for logout

after a target has send the async target requests logout event it may
reject each request with a waiting for logout reason. Catch these
rejects if an outstanding request and the logout event overlap.

Signed-off-by: Peter Lieven <pl@kamp.de>
pdu: handle async events 2,3,4

Signed-off-by: Peter Lieven <pl@kamp.de>
iscsi-command: do not fail commands while reconnect is pending

Signed-off-by: Peter Lieven <pl@kamp.de>
pdu: check callback on iscsi_process_reject

if the rejected packet is a NOP-Out it is legal
that it has no callback. In this case we end
up in a segfault.

Signed-off-by: Peter Lieven <pl@kamp.de>
pdu: fix statsn and factor out sn comparision

Signed-off-by: Peter Lieven <pl@kamp.de>
libiscsi: fix dangling pointer for outqueue_current

The outqueue_current PDU might also be in waitpdu if it does not have
ISCSI_PDU_DELETE_WHEN_SENT.  outqueue_current is freed after the
waitpdu list (for reconnect or defer_reconnect), or sometimes not
considered at all (for cancel), and this can cause a dangling pointer.

Keep outqueue_current up to date when a PDU is freed.  A bit hacky,
but it avoids touching code all over the place.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Merge pull request #123 from plieven/asyncv3

add support for async messages