[dovecot-cvs] dovecot/src/lib ostream-file.c,1.17,1.18

cras at procontrol.fi cras at procontrol.fi
Sat May 17 13:28:51 EEST 2003


Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv23666

Modified Files:
	ostream-file.c 
Log Message:
Automatically set file streams to blocking and don't try to io_add() them.



Index: ostream-file.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/ostream-file.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- ostream-file.c	17 May 2003 09:08:10 -0000	1.17
+++ ostream-file.c	17 May 2003 09:28:49 -0000	1.18
@@ -69,6 +69,7 @@
 	void *timeout_context;
 
 	unsigned int full:1; /* if head == tail, is buffer empty or full? */
+	unsigned int file:1;
 	unsigned int corked:1;
 	unsigned int no_socket_cork:1;
 	unsigned int no_sendfile:1;
@@ -124,7 +125,8 @@
 	fstream->timeout_cb = timeout_cb;
 	fstream->timeout_context = context;
 
-	net_set_nonblock(fstream->fd, timeout_msecs == 0);
+	if (!fstream->file)
+		net_set_nonblock(fstream->fd, timeout_msecs == 0);
 
 	if (timeout_msecs != 0)
 		alarm_hup_init();
@@ -472,7 +474,8 @@
 			fstream->full = TRUE;
 	}
 
-	if (sent != 0 && fstream->io == NULL && !fstream->corked) {
+	if (sent != 0 && fstream->io == NULL &&
+	    !fstream->corked && !fstream->file) {
 		fstream->io = io_add_priority(fstream->fd, fstream->priority,
 					      IO_WRITE, stream_send_io,
 					      fstream);
@@ -534,7 +537,7 @@
 	ssize_t ret;
 	int first;
 
-	/* set timeout time before flushing existing buffer which may block */
+	/* set timeout time before hflushing existing buffer which may block */
 	timeout_time = GET_TIMEOUT_TIME(foutstream);
         start_offset = instream->v_offset;
 
@@ -883,6 +886,9 @@
 		fstream->no_sendfile = TRUE;
 #endif
 		fstream->no_socket_cork = FALSE;
+		fstream->file = TRUE;
+
+		o_stream_set_blocking(ostream, 60000, 0, NULL);
 	} else {
 		if (net_getsockname(fd, NULL, NULL) < 0) {
 			fstream->no_sendfile = TRUE;



More information about the dovecot-cvs mailing list