Victor Duchovni: > On Mon, Dec 01, 2008 at 11:58:42AM -0500, Charles Marcus wrote: > > > On 12/1/2008 11:54 AM, Victor Duchovni wrote: > > > There is nothing wrong with lost connections after QUIT. Newer versions > > > of Postfix only log "lost connection" in the SMTP server during data > > > transfer or when sending the "." response. The client is free to > > > disconnect without "QUIT" at all other SMTP protocol stages. > > > > > > Sufficiently new Postfix releases will not log this condition. > > > > Hmmm... > > > > I'm running 2.5.5, and get this almost every time (maybe every time) > > when people send through the webmail interface... > > > > Sorry, Postfix won't log clients disconnecting without sending QUIT, > but it will log failure to send "221 ...". > > The reason is that with PIPELINEd ESMTP, the "250 ..." response to > "." and "221" response to QUIT are often sent in the same I/O operation, > so it is appropriate to report I/O errors when sending QUIT, at least > when there are previous responses in the output buffer. Postfix 2.3+ > complains about problems flushing QUIT unconditionally. > > quit_cmd(SMTPD_STATE *state, int unused_argc, SMTPD_TOKEN *unused_argv) > { > > /* > * Don't bother checking the syntax. > */ > smtpd_chat_reply(state, "221 2.0.0 Bye"); > > /* > * When the "." and quit replies are pipelined, make sure they are > * flushed now, to avoid repeated mail deliveries in case of a crash in > * the "clean up before disconnect" code. > * > * XXX When this was added in Postfix 2.1 we used vstream_fflush(). As > * of Postfix 2.3 we use smtp_flush() for better error reporting. > */ > smtp_flush(state->client); > return (0); > } > > perhaps the flush should be suppressed if there was no pending unwritten > data in the client vstream buffer prior to the "221 2.0.0 Bye" reply.
Postfix has a vstream_peek() function to count the amount of buffered input, but there is as of yet no API to count the amount of buffered output. I am not sure it is safe to overload vstream_peek() for this purpose, because that would break with full-duplex VSTREAMs when the last operation on the VSTREAM was a write. Wietse