if (total_size == 0)
return 0;
+ i_assert(!_stream->finished);
ret = _stream->sendv(_stream, iov, iov_count);
if (unlikely(ret != (ssize_t)total_size)) {
if (ret < 0) {
o_stream_nsend(stream, str, strlen(str));
}
+int o_stream_finish(struct ostream *stream)
+{
+ stream->real_stream->finished = TRUE;
+ return o_stream_flush(stream);
+}
+
void o_stream_ignore_last_errors(struct ostream *stream)
{
while (stream != NULL) {
return OSTREAM_SEND_ISTREAM_RESULT_ERROR_OUTPUT;
}
+ i_assert(!_outstream->finished);
res = _outstream->send_istream(_outstream, instream);
switch (res) {
case OSTREAM_SEND_ISTREAM_RESULT_FINISHED:
return -1;
}
+ i_assert(!stream->real_stream->finished);
ret = stream->real_stream->write_at(stream->real_stream,
data, size, offset);
if (unlikely(ret < 0)) {
{
return o_stream_flush(stream) < 0 ? -1 : 0;
}
+/* Mark the ostream as finished and flush it. If the ostream has a footer,
+ it's written here. Any further write attempts to the ostream will
+ assert-crash. Returns the same as o_stream_flush(). Afterwards any calls to
+ this function are identical to o_stream_flush(). */
+int o_stream_finish(struct ostream *stream);
/* Marks the stream's error handling as completed to avoid i_panic() on
destroy. */
void o_stream_ignore_last_errors(struct ostream *stream);