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

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

Date: Sat, 12 Nov 2011 23:07:38 +0200

To: Austin Clements

Cc: notmuch@notmuchmail.org

From: Tomi Ollila


On Sat, 12 Nov 2011 10:41:28 -0500, Austin Clements <amdragon@MIT.EDU> wrote:
> 
> 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.

SO, in our cases there are 2 options:


1) add line 
	{ echo QUIT > /dev/tcp/127.0.0.1/25025; } 2>/dev/null
  before 
	wait ${smtp_dummy_pid}

in test-lib.sh


2) add line
	kill ${smtp_dummy_pid}
  before 
	wait ${smtp_dummy_pid}

in test-lib.sh *and* add that fflush (output) before free (line) in 
smtp-dummy.c function receive_data_to_file.

folks! opinions!

Tomi

Thread: