Skip to content

Commit

Permalink
lib: Added i_stream_get_disconnect_reason()
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed May 11, 2016
1 parent d5d315d commit b96fdd9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib/istream.c
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/lib/istream.h
Expand Up @@ -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. */
Expand Down

0 comments on commit b96fdd9

Please sign in to comment.