summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-08-14 12:21:39 -0400
committerAdam <Adam@anope.org>2010-08-14 12:21:39 -0400
commitd1b5797f5d742fdd18a8fd6ae31e20992182155c (patch)
tree655e99a1ebc1693d962b5722b69c9c0c35fa3fcc
parenta2e9e45e3778c7a29a30fbe3523026df5a5b8304 (diff)
Added a config option that allows nix users to fork when sending mail, can drastically speed up mail sending on some boxes
-rw-r--r--Changes1
-rw-r--r--Changes.conf7
-rw-r--r--data/example.conf9
-rw-r--r--include/extern.h1
-rw-r--r--src/config.c2
-rw-r--r--src/mail.c11
-rw-r--r--version.log9
7 files changed, 34 insertions, 6 deletions
diff --git a/Changes b/Changes
index 6df6853c0..915c0933b 100644
--- a/Changes
+++ b/Changes
@@ -6,6 +6,7 @@ Anope Version 1.8 - SVN
05/22 A Added an internal event called when a nick is ghosted [ #00]
05/22 A Added an internal event called when a nick is recovered [ #00]
05/23 A Added old nick parameter to EVENT_CHANGE_NICK [ #00]
+08/13 A Added forking for mail sending on supporting operating systems [ #00]
04/15 F Fixed os_info to backup its database on Windows [ #00]
04/15 F Fixed a potential crash in cs_clear ops when using UnrealIRCd [#1154]
04/16 F Fixed missing TS6SID on FJOIN in inspircd12 [ #00]
diff --git a/Changes.conf b/Changes.conf
index a737d8be8..d759aa810 100644
--- a/Changes.conf
+++ b/Changes.conf
@@ -2,6 +2,13 @@ Anope Version 1.8 - SVN
-----------------------
** ADDED CONFIGURATION DIRECTIVES **
+# ForkForMail [OPTIONAL]
+#
+# When enabled, services will fork when sending mail, which means there is no
+# services lag from mail. This is only supported on operating systems that allow
+# the use of forking (eg, not Windows).
+#
+
** MODIFIED CONFIGURATION DIRECTIVES **
# DefSessionLimit <limit> [REQUIRED]
diff --git a/data/example.conf b/data/example.conf
index 5e0bb1b50..f3ce441d3 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -701,6 +701,15 @@ MailDelay 5m
#DontQuoteAddresses
+# ForkForMail [OPTIONAL]
+#
+# When enabled, services will fork when sending mail, which means there is no
+# services lag from mail. This is only supported on operating systems that allow
+# the use of forking (eg, not Windows).
+#
+
+#ForkForMail
+
###########################################################################
#
# NickServ configuration
diff --git a/include/extern.h b/include/extern.h
index c9d67cdbb..b46b4abc9 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -370,6 +370,7 @@ E char *SendFrom;
E int RestrictMail;
E int MailDelay;
E int DontQuoteAddresses;
+E int ForkForMail;
E int NSDefFlags;
E int NSDefLanguage;
diff --git a/src/config.c b/src/config.c
index 9ded27d89..793b608e6 100644
--- a/src/config.c
+++ b/src/config.c
@@ -127,6 +127,7 @@ char *SendFrom;
int RestrictMail;
int MailDelay;
int DontQuoteAddresses;
+int ForkForMail;
static int NSDefNone;
char *NSGuestNickPrefix;
@@ -429,6 +430,7 @@ Directive directives[] = {
{"DisableRaw", {{PARAM_SET, PARAM_RELOAD, &DisableRaw}}},
{"DontQuoteAddresses",
{{PARAM_SET, PARAM_RELOAD, &DontQuoteAddresses}}},
+ {"ForkForMail", {{PARAM_SET, PARAM_RELOAD, &ForkForMail}}},
{"DumpCore", {{PARAM_SET, 0, &DumpCore}}},
{"DefConLevel", {{PARAM_INT, PARAM_RELOAD, &DefConLevel}}},
{"DefCon1", {{PARAM_INT, PARAM_RELOAD, &DefCon1}}},
diff --git a/src/mail.c b/src/mail.c
index ee30bb61a..1e3109edd 100644
--- a/src/mail.c
+++ b/src/mail.c
@@ -175,6 +175,7 @@ MailInfo *MailMemoBegin(NickCore * nc)
*/
void MailEnd(MailInfo * mail)
{
+ int pid = -1;
/* - param checking modified because we don't
have an user sending this mail.
Certus, 02.04.2004 */
@@ -187,7 +188,15 @@ void MailEnd(MailInfo * mail)
return;
}
- pclose(mail->pipe);
+#ifdef HAVE_FORK
+ if (ForkForMail && !(pid = fork()))
+ {
+ pclose(mail->pipe);
+ exit(EXIT_SUCCESS);
+ }
+ else if (pid < 0)
+#endif
+ pclose(mail->pipe);
if (mail->sender) /* added sender check */
mail->sender->lastmail = time(NULL);
diff --git a/version.log b/version.log
index 1a3c19d5c..c51bf6af0 100644
--- a/version.log
+++ b/version.log
@@ -8,13 +8,12 @@ VERSION_MAJOR="1"
VERSION_MINOR="8"
VERSION_PATCH="4"
VERSION_EXTRA="-git"
-VERSION_BUILD="3023"
+VERSION_BUILD="3025"
# $Log$ # Changes since the 1.8.4 Release
-#Revision 3023 - Fixed minor wording error, and bumped version log from last
-commit
-#Revision 3022 - Removed \'s that appeared in kick message when BSGentleBWReason
-isn't used
+#Revision 3025 - Added in mail forking for operating systems that support it
+#Revision 3023 - Fixed minor wording error, and bumped version log from last commit
+#Revision 3022 - Removed \'s that appeared in kick message when BSGentleBWReason isn't used
#Revision 3021 - Removed Example.confs DefSessionLimit's reference to accepting 0, it doesn't.
#Revision 3020 - Fixed bug #1180 - Fixed tracking of internal clients when they change nicks on TS6 IRCds
#Revision 3019 - Properly track users hosts when a user is -x and has a vhost via chghost