summaryrefslogtreecommitdiff
path: root/src/mail.c
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 /src/mail.c
parenta2e9e45e3778c7a29a30fbe3523026df5a5b8304 (diff)
Added a config option that allows nix users to fork when sending mail, can drastically speed up mail sending on some boxes
Diffstat (limited to 'src/mail.c')
-rw-r--r--src/mail.c11
1 files changed, 10 insertions, 1 deletions
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);