Mercurial > dovecot > original-hg > dovecot-1.2
changeset 2431:8e9d8cb1e674 HEAD
Removed istream.disconnected, it's too much of a special case and the only
place where it's needed will be removed soon. Added istream.eof back, it's
more useful.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 22 Aug 2004 07:00:06 +0300 |
parents | 7c1dc4a7db3a |
children | b8d2a5575fe9 |
files | src/lib-mail/istream-header-filter.c src/lib-storage/index/mbox/istream-raw-mbox.c src/lib-storage/index/mbox/istream-raw-mbox.h src/lib-storage/index/mbox/mbox-sync.c src/lib/istream-data.c src/lib/istream-file.c src/lib/istream-limit.c src/lib/istream-mmap.c src/lib/istream.c src/lib/istream.h |
diffstat | 10 files changed, 20 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-mail/istream-header-filter.c Sun Aug 22 06:19:58 2004 +0300 +++ b/src/lib-mail/istream-header-filter.c Sun Aug 22 07:00:06 2004 +0300 @@ -129,7 +129,7 @@ } } - mstream->istream.istream.disconnected = mstream->input->disconnected; + mstream->istream.istream.eof = mstream->input->eof; mstream->istream.buffer = buffer_get_data(mstream->hdr_buf, &pos); ret = (ssize_t)(pos - mstream->istream.pos - mstream->istream.skip); mstream->istream.pos = pos; @@ -187,7 +187,7 @@ if (stream->skip == 0) return -2; } - stream->istream.disconnected = mstream->input->disconnected; + stream->istream.eof = mstream->input->eof; stream->buffer = i_stream_get_data(mstream->input, &pos); }
--- a/src/lib-storage/index/mbox/istream-raw-mbox.c Sun Aug 22 06:19:58 2004 +0300 +++ b/src/lib-storage/index/mbox/istream-raw-mbox.c Sun Aug 22 07:00:06 2004 +0300 @@ -18,7 +18,6 @@ unsigned int corrupted:1; unsigned int eom:1; - unsigned int eof:1; }; static void _close(struct _iostream *stream __attr_unused__) @@ -167,7 +166,7 @@ stream->pos = pos; rstream->eom = TRUE; - rstream->eof = TRUE; + stream->istream.eof = TRUE; handle_end_of_mail(rstream, pos); return ret < 0 ? _read(stream) : ret; } @@ -177,7 +176,7 @@ /* beginning of message, we haven't yet read our From-line */ if (mbox_read_from_line(rstream) < 0) { stream->pos = 0; - rstream->eof = TRUE; + stream->istream.eof = TRUE; rstream->corrupted = TRUE; return -1; } @@ -269,7 +268,6 @@ rstream->input_peak_offset = 0; rstream->eom = FALSE; - rstream->eof = FALSE; } struct istream *i_stream_create_raw_mbox(pool_t pool, struct istream *input) @@ -450,7 +448,7 @@ i_stream_seek(rstream->input, rstream->from_offset); rstream->eom = FALSE; - rstream->eof = FALSE; + stream->eof = FALSE; } int istream_raw_mbox_seek(struct istream *stream, uoff_t offset) @@ -461,7 +459,7 @@ rstream->corrupted = FALSE; rstream->eom = FALSE; - rstream->eof = FALSE; + stream->eof = FALSE; if (rstream->mail_size != (uoff_t)-1 && rstream->hdr_offset + rstream->mail_size == offset) { @@ -509,11 +507,3 @@ rstream->istream.skip = 0; rstream->istream.pos = 0; } - -int istream_raw_mbox_is_eof(struct istream *stream) -{ - struct raw_mbox_istream *rstream = - (struct raw_mbox_istream *)stream->real_stream; - - return rstream->eof; -}
--- a/src/lib-storage/index/mbox/istream-raw-mbox.h Sun Aug 22 06:19:58 2004 +0300 +++ b/src/lib-storage/index/mbox/istream-raw-mbox.h Sun Aug 22 07:00:06 2004 +0300 @@ -36,7 +36,4 @@ /* Flush all buffering. Call if you modify the mbox. */ void istream_raw_mbox_flush(struct istream *stream); -/* Returns TRUE if we've read the whole mbox. */ -int istream_raw_mbox_is_eof(struct istream *stream); - #endif
--- a/src/lib-storage/index/mbox/mbox-sync.c Sun Aug 22 06:19:58 2004 +0300 +++ b/src/lib-storage/index/mbox/mbox-sync.c Sun Aug 22 07:00:06 2004 +0300 @@ -111,7 +111,7 @@ { /* get EOF */ (void)istream_raw_mbox_get_header_offset(sync_ctx->input); - if (istream_raw_mbox_is_eof(sync_ctx->input)) + if (sync_ctx->input->eof) return 0; memset(mail_ctx, 0, sizeof(*mail_ctx)); @@ -826,7 +826,7 @@ } } - if (istream_raw_mbox_is_eof(sync_ctx->input)) { + if (sync_ctx->input->eof) { /* rest of the messages in index don't exist -> expunge them */ while (sync_ctx->idx_seq <= messages_count) mail_index_expunge(sync_ctx->t, sync_ctx->idx_seq++); @@ -841,7 +841,7 @@ uoff_t offset, padding, trailer_size; int need_rewrite; - if (!istream_raw_mbox_is_eof(sync_ctx->input)) { + if (!sync_ctx->input->eof) { i_assert(sync_ctx->need_space_seq == 0); i_assert(sync_ctx->expunged_space == 0); return 0; @@ -938,7 +938,7 @@ sizeof(sync_ctx->base_uid_validity)); } - if (istream_raw_mbox_is_eof(sync_ctx->input) && + if (sync_ctx->input->eof && sync_ctx->next_uid != sync_ctx->hdr->next_uid) { i_assert(sync_ctx->next_uid != 0); mail_index_update_header(sync_ctx->t,
--- a/src/lib/istream-data.c Sun Aug 22 06:19:58 2004 +0300 +++ b/src/lib/istream-data.c Sun Aug 22 07:00:06 2004 +0300 @@ -18,6 +18,7 @@ static ssize_t _read(struct _istream *stream __attr_unused__) { + stream->istream.eof = TRUE; return -1; }
--- a/src/lib/istream-file.c Sun Aug 22 06:19:58 2004 +0300 +++ b/src/lib/istream-file.c Sun Aug 22 07:00:06 2004 +0300 @@ -117,21 +117,15 @@ } if (ret == 0) { /* EOF */ - if (!fstream->file) - stream->istream.disconnected = TRUE; + stream->istream.eof = TRUE; return -1; } if (ret < 0) { - if (errno == ECONNRESET || errno == ETIMEDOUT) { - /* treat as disconnection */ - stream->istream.disconnected = TRUE; - return -1; - } - if (errno == EINTR || errno == EAGAIN) ret = 0; else { + stream->istream.eof = TRUE; stream->istream.stream_errno = errno; return -1; }
--- a/src/lib/istream-limit.c Sun Aug 22 06:19:58 2004 +0300 +++ b/src/lib/istream-limit.c Sun Aug 22 07:00:06 2004 +0300 @@ -55,7 +55,7 @@ if (stream->skip == 0) return -2; } - stream->istream.disconnected = lstream->input->disconnected; + stream->istream.eof = lstream->input->eof; stream->buffer = i_stream_get_data(lstream->input, &pos); }
--- a/src/lib/istream-mmap.c Sun Aug 22 06:19:58 2004 +0300 +++ b/src/lib/istream-mmap.c Sun Aug 22 07:00:06 2004 +0300 @@ -82,8 +82,10 @@ return stream->pos - stream->skip; } - if (stream->istream.v_offset >= mstream->v_size) + if (stream->istream.v_offset >= mstream->v_size) { + stream->istream.eof = TRUE; return -1; + } aligned_skip = stream->skip & ~mmap_pagemask; if (aligned_skip == 0 && mstream->mmap_base != NULL) {
--- a/src/lib/istream.c Sun Aug 22 06:19:58 2004 +0300 +++ b/src/lib/istream.c Sun Aug 22 07:00:06 2004 +0300 @@ -39,7 +39,7 @@ if (stream->closed) return -1; - stream->disconnected = FALSE; + stream->eof = FALSE; return _stream->read(_stream); } @@ -79,7 +79,7 @@ if (stream->closed) return; - stream->disconnected = FALSE; + stream->eof = FALSE; _stream->seek(_stream, v_offset); }
--- a/src/lib/istream.h Sun Aug 22 06:19:58 2004 +0300 +++ b/src/lib/istream.h Sun Aug 22 07:00:06 2004 +0300 @@ -7,7 +7,7 @@ int stream_errno; unsigned int mmaped:1; /* be careful when copying data */ unsigned int closed:1; - unsigned int disconnected:1; + unsigned int eof:1; struct _istream *real_stream; };