[PATCH] test: attempt to send QUIT to smtp-dummy in case mail send failed

Austin Clements amdragon at MIT.EDU
Sat Nov 12 07:41:28 PST 2011


Quoth Tomi Ollila on Nov 12 at 12:02 pm:
> On Fri, 11 Nov 2011 21:49:41 -0500, Austin Clements <amdragon at MIT.EDU> wrote:
> > Good idea, but this introduces a dependency on netcat.  Would it work
> > to simply kill the SMTP dummy?
> 
> I cannot guarantee 6 nines of probability (but can guarantee as many eights
> as one migh wish ;)
> 
> Socket buffering and timing might cause smtp dummy to be killed before
> it has read all content...
> 
> But... i recall bash has a way to do tcp stuff .../dev/tcp/host/port
> is mentioned in manual page.
> I'll investigate this later (or, anyone of you, provide a patch :)

Actually, since sending mail is synchronous, there shouldn't be any
issues with buffering or timing.  If Emacs successfully sends the
message, it will wait for the OK response (`smtpmail-via-smtp'), which
should indicate that the message is in stable storage on the SMTP
server (this is rather fundamental to SMTP's reliability as a
protocol, after all).  Thus, the smtp-dummy *should* be done by the
time Emacs exits.  If Emacs fails to send the message, then it doesn't
really matter and you just want the smtp-dummy to go away.

I say "should" because smtp-dummy needs a one line patch to add an
fflush at the end of receive_data_to_file.  Any real SMTP server would
do this (not to mention a full fsync) before acknowledging the
message.


More information about the notmuch mailing list