Keep ManageSieve listener alive across sessions
Debian Trixie package bundle / packages (push) Successful in 22m14s
Debian Trixie package bundle / packages (push) Successful in 22m14s
This commit is contained in:
@@ -219,6 +219,12 @@ def managesieve() -> str:
|
||||
return "upload, activate, retrieve, rename and delete passed"
|
||||
|
||||
|
||||
def managesieve_repeated() -> str:
|
||||
first = managesieve()
|
||||
second = managesieve()
|
||||
return f"two consecutive sessions passed ({first}; {second})"
|
||||
|
||||
|
||||
def smtp_implicit() -> str:
|
||||
with smtplib.SMTP_SSL(HOST, PORTS["smtps"], timeout=15,
|
||||
context=TLS) as client:
|
||||
@@ -310,10 +316,11 @@ def main() -> int:
|
||||
if not PASSWORD:
|
||||
parser.error("BONGO_TEST_PASSWORD must be set")
|
||||
if arguments.sieve_only:
|
||||
return 0 if report("ManageSieve NMAP Store", managesieve) else 1
|
||||
return 0 if report(
|
||||
"ManageSieve NMAP Store", managesieve_repeated) else 1
|
||||
checks = [
|
||||
("listener readiness", wait_for_listeners),
|
||||
("ManageSieve NMAP Store", managesieve),
|
||||
("ManageSieve NMAP Store", managesieve_repeated),
|
||||
("SMTP submission STARTTLS", smtp_submit),
|
||||
("SMTPS submission", smtp_implicit),
|
||||
("IMAPS delivery", wait_for_imap),
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <connio.h>
|
||||
#include <msgapi.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -338,11 +339,21 @@ apply_proxy_protocol(Connection *connection)
|
||||
static void server_loop(void *unused)
|
||||
{
|
||||
(void)unused;
|
||||
while (BongoAgentGetState(&agent) < BONGO_AGENT_STATE_STOPPING) {
|
||||
while (BongoAgentGetState(&agent) < BONGO_AGENT_STATE_UNLOADING) {
|
||||
Connection *connection = NULL;
|
||||
XplThreadID client_id;
|
||||
int result;
|
||||
if (ConnAccept(listener, &connection) == -1) continue;
|
||||
if (ConnAccept(listener, &connection) == -1) {
|
||||
if (BongoAgentGetState(&agent) >= BONGO_AGENT_STATE_UNLOADING)
|
||||
break;
|
||||
if (!listener || listener->socket == -1) {
|
||||
Log(LOG_ERROR,
|
||||
"ManageSieve listener closed unexpectedly; exiting for supervisor restart");
|
||||
BongoAgentSetState(&agent, BONGO_AGENT_STATE_STOPPING);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!apply_proxy_protocol(connection)) {
|
||||
ConnClose(connection);
|
||||
ConnFree(connection);
|
||||
@@ -364,9 +375,12 @@ static void server_loop(void *unused)
|
||||
}
|
||||
}
|
||||
|
||||
static void signal_handler(int signal) {
|
||||
BongoAgentHandleSignal(&agent, signal);
|
||||
if (listener) ConnClose(listener);
|
||||
static void signal_handler(int signal_number)
|
||||
{
|
||||
BongoAgentHandleSignal(&agent, signal_number);
|
||||
if ((signal_number == SIGHUP || signal_number == SIGINT ||
|
||||
signal_number == SIGTERM) && listener)
|
||||
ConnClose(listener);
|
||||
}
|
||||
XplServiceCode(signal_handler)
|
||||
|
||||
@@ -417,5 +431,7 @@ int XplServiceMain(int argc, char **argv)
|
||||
}
|
||||
ConnSSLContextFree(tls_context);
|
||||
BongoSaslShutdown();
|
||||
BongoAgentShutdown(&agent);
|
||||
listener = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user