return strerror(stream->stream_errno);
}
+const char *i_stream_get_disconnect_reason(struct istream *stream)
+{
+ return io_stream_get_disconnect_reason(stream, NULL);
+}
+
void i_stream_close(struct istream *stream)
{
i_stream_close_full(stream, TRUE);
/* Returns error string for the last error. It also returns "EOF" in case there
is no error, but eof is set. Otherwise it returns "<no error>". */
const char *i_stream_get_error(struct istream *stream);
+/* Returns human-readable reason for why istream was disconnected. This can be
+ called to log the error when i_stream_read() returns -1. If there's an error
+ the output is identical to i_stream_get_error(). */
+const char *i_stream_get_disconnect_reason(struct istream *stream);
/* Mark the stream and all of its parent streams closed. Any reads after this
will return -1. The data already read can still be used. */