[dovecot-cvs] dovecot/src/lib ostream-file.c,1.47,1.48

cras at dovecot.org cras at dovecot.org
Tue Apr 26 14:08:18 EEST 2005


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv18718

Modified Files:
	ostream-file.c 
Log Message:
Try to flush output before uncorking



Index: ostream-file.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/ostream-file.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- ostream-file.c	26 Apr 2005 10:43:57 -0000	1.47
+++ ostream-file.c	26 Apr 2005 11:08:16 -0000	1.48
@@ -216,27 +216,26 @@
 static void _cork(struct _ostream *stream, int set)
 {
 	struct file_ostream *fstream = (struct file_ostream *)stream;
+	int ret;
 
 	if (fstream->corked != set && !stream->ostream.closed) {
-		if (!fstream->no_socket_cork) {
-			if (net_set_cork(fstream->fd, set) < 0)
-				fstream->no_socket_cork = TRUE;
-		}
-		fstream->corked = set;
-
 		if (set && fstream->io != NULL) {
 			io_remove(fstream->io);
 			fstream->io = NULL;
 		} else if (!set) {
-			if (fstream->file)
-				buffer_flush(fstream);
-			else if (fstream->io == NULL &&
-				 (!IS_STREAM_EMPTY(fstream) ||
-				  fstream->flush_pending)) {
+			ret = buffer_flush(fstream);
+			if (fstream->io == NULL &&
+			    (ret == 0 || fstream->flush_pending)) {
 				fstream->io = io_add(fstream->fd, IO_WRITE,
 						     stream_send_io, fstream);
 			}
 		}
+
+		if (!fstream->no_socket_cork) {
+			if (net_set_cork(fstream->fd, set) < 0)
+				fstream->no_socket_cork = TRUE;
+		}
+		fstream->corked = set;
 	}
 }
 



More information about the dovecot-cvs mailing list