idevice: Fix mistreatment of 0-byte sent cases
Currently if 0 byte gets sent, it is treated as not-enough-data.
This is wrong, because with TCP, 0-byte-sent usually means the
receiver end is closed. We must set a new case for this and must
not normalize the sent-bytes to 0 in general.
diff --git a/src/idevice.c b/src/idevice.c
index d6c1d06..f64570b 100644
--- a/src/idevice.c
+++ b/src/idevice.c
@@ -650,7 +650,10 @@
}
debug_info("len %d, sent %d", len, sent);
if (sent < len) {
- *sent_bytes = 0;
+ *sent_bytes = sent;
+ if (sent == 0) {
+ return IDEVICE_E_UNKNOWN_ERROR;
+ }
return IDEVICE_E_NOT_ENOUGH_DATA;
}
*sent_bytes = sent;