Fixed potential infinite loop with content receiver

This commit is contained in:
yhirose 2020-05-10 20:45:57 -04:00
parent 49c4c2f9c1
commit ba685dbe48

View File

@ -2083,7 +2083,9 @@ inline ssize_t write_content(Stream &strm, ContentProvider content_provider,
written_length = strm.write(d, l);
};
data_sink.done = [&](void) { written_length = -1; };
data_sink.is_writable = [&](void) { return strm.is_writable(); };
data_sink.is_writable = [&](void) {
return strm.is_writable() && written_length >= 0;
};
content_provider(offset, end_offset - offset, data_sink);
if (written_length < 0) { return written_length; }