From d1b5797f5d742fdd18a8fd6ae31e20992182155c Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 14 Aug 2010 12:21:39 -0400 Subject: Added a config option that allows nix users to fork when sending mail, can drastically speed up mail sending on some boxes --- src/config.c | 2 ++ src/mail.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src') 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); -- cgit