Message ID | f5a4c0b1-4396-fd88-6006-0ab3af397a11@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
> but then fails the assertion, which means read_sync() is returning 0 in > our particular test (which sort of makes sense: the test is purposefully > truncating the server stream at various points to see how the client > reacts). I'm trying to figure out if always treating early EOF as a > read error would be sufficient to make things work the way we want in > the client. Yeah, early EOF should become ESHUTDOWN, ECONNRESET or similar. Paolo
diff --git i/nbd/client.c w/nbd/client.c index 5d94e34..23ad4f1 100644 --- i/nbd/client.c +++ w/nbd/client.c @@ -87,10 +87,11 @@ static ssize_t drop_sync(QIOChannel *ioc, size_t size) while (size > 0) { ret = read_sync(ioc, buffer, MIN(65536, size)); if (ret < 0) { goto cleanup; } + assert(ret); assert(ret <= size); size -= ret; } ret = dropped;