[dovecot-cvs] dovecot/src/lib istream-data.c, 1.9, 1.10 istream-file.c, 1.18, 1.19 istream-limit.c, 1.7, 1.8 istream-mmap.c, 1.12, 1.13 istream.c, 1.20, 1.21 istream.h, 1.11, 1.12

cras at dovecot.org cras at dovecot.org
Sun Aug 22 07:00:08 EEST 2004


Update of /home/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv29108/lib

Modified Files:
	istream-data.c istream-file.c istream-limit.c istream-mmap.c 
	istream.c istream.h 
Log Message:
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.



Index: istream-data.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/istream-data.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- istream-data.c	15 Aug 2004 03:40:31 -0000	1.9
+++ istream-data.c	22 Aug 2004 04:00:06 -0000	1.10
@@ -18,6 +18,7 @@
 
 static ssize_t _read(struct _istream *stream __attr_unused__)
 {
+	stream->istream.eof = TRUE;
 	return -1;
 }
 

Index: istream-file.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/istream-file.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- istream-file.c	15 Aug 2004 03:40:31 -0000	1.18
+++ istream-file.c	22 Aug 2004 04:00:06 -0000	1.19
@@ -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;
 		}

Index: istream-limit.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/istream-limit.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- istream-limit.c	15 Aug 2004 03:40:31 -0000	1.7
+++ istream-limit.c	22 Aug 2004 04:00:06 -0000	1.8
@@ -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);
 	}
 

Index: istream-mmap.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/istream-mmap.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- istream-mmap.c	15 Aug 2004 03:40:31 -0000	1.12
+++ istream-mmap.c	22 Aug 2004 04:00:06 -0000	1.13
@@ -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) {

Index: istream.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/istream.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- istream.c	15 Aug 2004 03:40:31 -0000	1.20
+++ istream.c	22 Aug 2004 04:00:06 -0000	1.21
@@ -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);
 }
 

Index: istream.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib/istream.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- istream.h	15 Aug 2004 03:40:31 -0000	1.11
+++ istream.h	22 Aug 2004 04:00:06 -0000	1.12
@@ -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;
 };



More information about the dovecot-cvs mailing list