On Fri, 20 May 2005, Philip Hazel wrote:
> On Fri, 20 May 2005, Ian FREISLICH wrote:
>
> > You can do much the same with select(). Just replace my use of
> > poll() with appropriate select() magic. The purpose of this code
> > snippet was not to demonstrate the use of poll, but non-blocking
> > IO. When you write to an fd, it may block and you have no idea how
> > much you can write before it will block. If it's set to O_NONBLOCK,
> > as soon as poll()/select() says you can write without blocking, you
> > write() and write() returns at the point it would block with the
> > number of bytes actually written.
>
> OK. Point taken.
However, when I came to look at possibly doing something to the code, I
realized that it is complicated by the TLS case. I am not sure if it is
even possible to do any kind of blocking check when TLS is in use. So I
have left the code as it is. Well, almost. While reading it I noticed a
bug: when a buffer is only partly written by one write() call, Exim was
re-applying the same timeout to the next write(). This seems wrong, as
it would allow a very slow acceptor to delay for a very long time. So I
fixed that.
Philip
--
Philip Hazel University of Cambridge Computing Service,
ph10@??? Cambridge, England. Phone: +44 1223 334714.