Mercurial > dovecot > core-2.2
changeset 1478:ce6521e4a191 HEAD
Automatically set file streams to blocking and don't try to io_add() them.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 17 May 2003 12:28:49 +0300 |
parents | 280e6d3772c9 |
children | 6f5d7b43fe53 |
files | src/lib/ostream-file.c |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib/ostream-file.c Sat May 17 12:16:16 2003 +0300 +++ b/src/lib/ostream-file.c Sat May 17 12:28:49 2003 +0300 @@ -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;