this way streams can check if their parent streams have been
accessed behind them. */
unsigned int access_counter;
+ /* Timestamp when read() last returned >0 */
+ struct timeval last_read_timeval;
string_t *line_str; /* for i_stream_next_line() if w_buffer == NULL */
bool line_crlf:1;
i_assert(ret > 0);
i_assert(_stream->skip < _stream->pos);
i_assert((size_t)ret+old_size == _stream->pos - _stream->skip);
+ _stream->last_read_timeval = ioloop_timeval;
break;
}
return ret;
}
+void i_stream_get_last_read_time(struct istream *stream, struct timeval *tv_r)
+{
+ *tv_r = stream->real_stream->last_read_timeval;
+}
+
ssize_t i_stream_read_copy_from_parent(struct istream *istream)
{
struct istream_private *stream = istream->real_stream;
{
return i_stream_read_bytes(stream, data_r, size_r, 1);
}
+/* Return the timestamp when istream last successfully read something.
+ The timestamp is 0 if nothing has ever been read. */
+void i_stream_get_last_read_time(struct istream *stream, struct timeval *tv_r);
/* Append external data to input stream. Returns TRUE if successful, FALSE if
there is not enough space in the stream. */