changeset 3401:c19d6448f856 HEAD

Set output I/O handler after output callback if needed.
author Timo Sirainen <tss@iki.fi>
date Sun, 29 May 2005 13:50:06 +0300
parents ddfa507bb74f
children 513abd166949
files src/lib/ostream-file.c
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/ostream-file.c	Sun May 29 03:26:19 2005 +0300
+++ b/src/lib/ostream-file.c	Sun May 29 13:50:06 2005 +0300
@@ -364,11 +364,17 @@
 	if (ret == 0)
 		fstream->flush_pending = TRUE;
 
-	if (!fstream->flush_pending &&
-	    IS_STREAM_EMPTY(fstream) && fstream->io != NULL) {
-		/* all sent */
-		io_remove(fstream->io);
-		fstream->io = NULL;
+	if (!fstream->flush_pending && IS_STREAM_EMPTY(fstream)) {
+		if (fstream->io != NULL) {
+			/* all sent */
+			io_remove(fstream->io);
+			fstream->io = NULL;
+		}
+	} else {
+		if (fstream->io == NULL) {
+			fstream->io = io_add(fstream->fd, IO_WRITE,
+					     stream_send_io, fstream);
+		}
 	}
 
 	o_stream_unref(&fstream->ostream.ostream);