diff options
author | Philip Hazel <ph10@hermes.cam.ac.uk> | 2007-02-06 12:19:27 +0000 |
---|---|---|
committer | Philip Hazel <ph10@hermes.cam.ac.uk> | 2007-02-06 12:19:27 +0000 |
commit | 4c590bd11647b7440bd982a8c72ebcf5c66564b0 (patch) | |
tree | 98c5d7e87d60defe5bf522c023a453919303eb98 /src | |
parent | 14f4a80da26686a979d4ac4c7040cb3e6350a746 (diff) |
Flush SMTP before callout (unless control=no_callout_flush).
Diffstat (limited to 'src')
-rw-r--r-- | src/src/acl.c | 16 | ||||
-rw-r--r-- | src/src/globals.c | 3 | ||||
-rw-r--r-- | src/src/globals.h | 3 | ||||
-rw-r--r-- | src/src/verify.c | 10 |
4 files changed, 26 insertions, 6 deletions
diff --git a/src/src/acl.c b/src/src/acl.c index 0f484f21d..d0ed0a51c 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/acl.c,v 1.71 2007/02/06 11:16:21 ph10 Exp $ */ +/* $Cambridge: exim/src/src/acl.c,v 1.72 2007/02/06 12:19:27 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -188,7 +188,8 @@ enum { CONTROL_FAKEREJECT, CONTROL_NO_MULTILINE, CONTROL_NO_PIPELINING, - CONTROL_NO_DELAY_FLUSH + CONTROL_NO_DELAY_FLUSH, + CONTROL_NO_CALLOUT_FLUSH }; /* ACL control names; keep in step with the table above! This list is used for @@ -220,7 +221,8 @@ static uschar *controls[] = { US"fakereject", US"no_multiline", US"no_pipelining", - US"no_delay_flush" + US"no_delay_flush", + US"no_callout_flush" }; /* Flags to indicate for which conditions/modifiers a string expansion is done @@ -598,6 +600,9 @@ static unsigned int control_forbids[] = { (1<<ACL_WHERE_NOTSMTP_START), (1<<ACL_WHERE_NOTSMTP)| /* no_delay_flush */ + (1<<ACL_WHERE_NOTSMTP_START), + + (1<<ACL_WHERE_NOTSMTP)| /* no_callout_flush */ (1<<ACL_WHERE_NOTSMTP_START) }; @@ -621,6 +626,7 @@ static control_def controls_list[] = { { US"caselower_local_part", CONTROL_CASELOWER_LOCAL_PART, FALSE }, { US"enforce_sync", CONTROL_ENFORCE_SYNC, FALSE }, { US"freeze", CONTROL_FREEZE, TRUE }, + { US"no_callout_flush", CONTROL_NO_CALLOUT_FLUSH, FALSE }, { US"no_delay_flush", CONTROL_NO_DELAY_FLUSH, FALSE }, { US"no_enforce_sync", CONTROL_NO_ENFORCE_SYNC, FALSE }, { US"no_multiline_responses", CONTROL_NO_MULTILINE, FALSE }, @@ -2615,6 +2621,10 @@ for (; cb != NULL; cb = cb->next) disable_delay_flush = TRUE; break; + case CONTROL_NO_CALLOUT_FLUSH: + disable_callout_flush = TRUE; + break; + case CONTROL_FAKEDEFER: case CONTROL_FAKEREJECT: fake_response = (control_type == CONTROL_FAKEDEFER) ? DEFER : FAIL; diff --git a/src/src/globals.c b/src/src/globals.c index a8122d0bc..5f4ed83fd 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.c,v 1.70 2007/02/06 11:11:40 ph10 Exp $ */ +/* $Cambridge: exim/src/src/globals.c,v 1.71 2007/02/06 12:19:27 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -499,6 +499,7 @@ int demime_errorlevel = 0; int demime_ok = 0; uschar *demime_reason = NULL; #endif +BOOL disable_callout_flush = FALSE; BOOL disable_delay_flush = FALSE; #ifdef ENABLE_DISABLE_FSYNC BOOL disable_fsync = FALSE; diff --git a/src/src/globals.h b/src/src/globals.h index 09674f22b..48b4e0ecc 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.h,v 1.50 2007/02/06 11:11:40 ph10 Exp $ */ +/* $Cambridge: exim/src/src/globals.h,v 1.51 2007/02/06 12:19:27 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -278,6 +278,7 @@ extern int demime_errorlevel; /* Severity of MIME error */ extern int demime_ok; /* Nonzero if message has been demimed */ extern uschar *demime_reason; /* Reason for broken MIME container */ #endif +extern BOOL disable_callout_flush; /* Don't flush before callouts */ extern BOOL disable_delay_flush; /* Don't flush before "delay" in ACL */ #ifdef ENABLE_DISABLE_FSYNC extern BOOL disable_fsync; /* Not for normal use */ diff --git a/src/src/verify.c b/src/src/verify.c index 5ec90aaa8..d71f7e774 100644 --- a/src/src/verify.c +++ b/src/src/verify.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/verify.c,v 1.47 2007/01/30 15:10:59 ph10 Exp $ */ +/* $Cambridge: exim/src/src/verify.c,v 1.48 2007/02/06 12:19:27 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -385,6 +385,14 @@ if (callout_overall < 0) callout_overall = 4 * callout; if (callout_connect < 0) callout_connect = callout; callout_start_time = time(NULL); +/* Before doing a real callout, if this is an SMTP connection, flush the SMTP +output because a callout might take some time. When PIPELINING is active and +there are many recipients, the total time for doing lots of callouts can add up +and cause the client to time out. So in this case we forgo the PIPELINING +optimization. */ + +if (smtp_out != NULL && !disable_callout_flush) mac_smtp_fflush(); + /* Now make connections to the hosts and do real callouts. The list of hosts is passed in as an argument. */ |