diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-03-12 21:55:08 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-03-12 21:55:08 +0000 |
commit | c63d563fc199d3234a4ceb7dbb343ba749da7353 (patch) | |
tree | e85c2901a521bfc772801bfc4886fefcb32b21b0 /mfd | |
parent | 07336ea55b20a411f86bef4133c3a8988d229922 (diff) | |
download | mailfromd-c63d563fc199d3234a4ceb7dbb343ba749da7353.tar.gz mailfromd-c63d563fc199d3234a4ceb7dbb343ba749da7353.tar.bz2 |
Fix the current_message function and subprocess handling in mtasim.
* mtasim/mtasim.c (stop_mailfromd): Wait for the mailfromd child
to terminate and analyze its return status.
* mfd/bi_msg.m4 (bi_drop_current_message): New function.
* mfd/prog.c (env_capture_start): Call bi_drop_current_message if
the capture stream already exists (i.e. when starting processing
2nd or later message in a session).
* mfd/msg.h (bi_drop_current_message): New prototype.
* gacopyz/server.c (srv_connect): Retry attempts to connect
if they fail with ECONNREFUSED. Implement 5-second timeout.
* tests/testsuite.at (MAILFROMD_OPTIONS): New define.
(AT_MTA_TEST): Pass MAILFROMD_OPTIONS to mtasim invocation.
(AT_WITH_MAILFROMD_OPTIONS): New macro.
Include curmsg.at.
* tests/curmsg.at: New file
* tests/etc/Makefile.am (RCFILES): Add size.rc
* tests/etc/size.rc: New file
git-svn-id: file:///svnroot/mailfromd/trunk@1779 7a8a7f39-df28-0410-adc6-e0d955640f24
Diffstat (limited to 'mfd')
-rw-r--r-- | mfd/bi_msg.m4 | 12 | ||||
-rw-r--r-- | mfd/msg.h | 1 | ||||
-rw-r--r-- | mfd/prog.c | 6 |
3 files changed, 19 insertions, 0 deletions
diff --git a/mfd/bi_msg.m4 b/mfd/bi_msg.m4 index 5bd172c0..43882435 100644 --- a/mfd/bi_msg.m4 +++ b/mfd/bi_msg.m4 @@ -96,6 +96,18 @@ bi_get_current_message(eval_environ_t env) return -1; } +void +bi_drop_current_message(eval_environ_t env) +{ + int i; + struct mf_message *tab = MF_GET_DATA; + for (i = 0; i < NMSGS; i++) + if (tab[i].msg && tab[i].current) { + bi_close_message(&tab[i]); + break; + } +} + m4_define([<DCL_MSG>],[< struct mf_message *mtab = MF_GET_DATA; @@ -41,4 +41,5 @@ void bi_close_message(struct mf_message *msg); int bi_message_register(eval_environ_t env, mu_list_t list, mu_message_t msg, int current); int bi_get_current_message(eval_environ_t env); +void bi_drop_current_message(eval_environ_t env); mu_message_t bi_message_from_descr(eval_environ_t env, int md); @@ -31,6 +31,7 @@ #include <syslog.h> #include "mailfromd.h" #include "prog.h" +#include "msg.h" #include "optab.h" #define DEFINE_BUILTIN_MODULE #include "builtin.h" @@ -2105,6 +2106,11 @@ env_capture_start(eval_environ_t env) int rc; if (env->stream) { + /* Drop any previously registered current message */ + bi_drop_current_message(env); + + /* Truncate existing stream and reposition to its + beginning */ rc = mu_stream_truncate(env->stream, 0); if (rc == 0 && mu_stream_seek(env->stream, 0, SEEK_SET) == 0) return 0; |