]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Added i_stream_get_disconnect_reason()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 6 May 2016 11:34:57 +0000 (14:34 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 10 May 2016 21:22:36 +0000 (17:22 -0400)
src/lib/istream.c
src/lib/istream.h

index 2d70a230db798a1477501590c888913f48474dbd..d525c8b770156323fe05571f962952df35f943b4 100644 (file)
@@ -97,6 +97,11 @@ const char *i_stream_get_error(struct istream *stream)
        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);
index 0c96e9896719a0b48f9bbd8f865c58e55a615dba..025afd0f54c5c02da662be2138c250b7a4b98c8a 100644 (file)
@@ -77,6 +77,10 @@ int i_stream_get_fd(struct istream *stream);
 /* 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. */