Commit 71f88e90 authored by Tomasz Lemiech's avatar Tomasz Lemiech Committed by David Edmundson
Browse files

ksmserver: reject new clients when shutting down

When ksmserver is about to shut down and in the process of killing its
clients, it shouldn't accept connections from new clients.

BUG: 432643
parent b64be79d
Pipeline #111925 passed with stage
in 4 minutes and 33 seconds
......@@ -457,6 +457,15 @@ static Status KSMNewClientProc(SmsConn conn, SmPointer manager_data, unsigned lo
*failure_reason_ret = nullptr;
void *client = ((KSMServer *)manager_data)->newClient(conn);
if(client == NULL) {
const char *errstr = "Connection rejected: ksmserver is shutting down";
qCWarning(KSMSERVER, "%s", errstr);
if ((*failure_reason_ret = (char *)malloc(strlen(errstr) + 1)) != NULL) {
strcpy(*failure_reason_ret, errstr);
}
return 0;
}
cb->register_client.callback = KSMRegisterClientProc;
cb->register_client.manager_data = client;
......@@ -690,8 +699,11 @@ void KSMServer::processData(int /*socket*/)
KSMClient *KSMServer::newClient(SmsConn conn)
{
KSMClient *client = new KSMClient(conn);
clients.append(client);
KSMClient *client = nullptr;
if(state != Killing) {
client = new KSMClient(conn);
clients.append(client);
}
return client;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment