Commit 24c42813 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

NXdispatch.c: call upstream CloseDownClient()

remove ~80 duplicate lines
parent c02ab70e
...@@ -3480,11 +3480,14 @@ InitProcVectors(void) ...@@ -3480,11 +3480,14 @@ InitProcVectors(void)
* then killed again, the client is really destroyed. * then killed again, the client is really destroyed.
*********************/ *********************/
#ifndef NXAGENT_SERVER
char dispatchExceptionAtReset = DE_RESET; char dispatchExceptionAtReset = DE_RESET;
void void
CloseDownClient(register ClientPtr client) #ifdef NXAGENT_SERVER
xorg_CloseDownClient(ClientPtr client)
#else
CloseDownClient(ClientPtr client)
#endif
{ {
Bool really_close_down = client->clientGone || Bool really_close_down = client->clientGone ||
client->closeDownMode == DestroyAll; client->closeDownMode == DestroyAll;
...@@ -3569,7 +3572,6 @@ CloseDownClient(register ClientPtr client) ...@@ -3569,7 +3572,6 @@ CloseDownClient(register ClientPtr client)
currentMaxClients--; currentMaxClients--;
} }
} }
#endif /* NXAGENT_SERVER */
static void static void
KillAllClients() KillAllClients()
......
...@@ -128,8 +128,6 @@ Equipment Corporation. ...@@ -128,8 +128,6 @@ Equipment Corporation.
const int nxagentMaxFontNames = 10000; const int nxagentMaxFontNames = 10000;
char dispatchExceptionAtReset = DE_RESET;
/* /*
* This allows the agent to exit if no * This allows the agent to exit if no
* client is connected within a timeout. * client is connected within a timeout.
...@@ -1089,9 +1087,6 @@ int ProcForceScreenSaver(register ClientPtr client) ...@@ -1089,9 +1087,6 @@ int ProcForceScreenSaver(register ClientPtr client)
void void
CloseDownClient(register ClientPtr client) CloseDownClient(register ClientPtr client)
{ {
Bool really_close_down = client->clientGone ||
client->closeDownMode == DestroyAll;
/* /*
* There must be a better way to hook a * There must be a better way to hook a
* call-back function to be called any * call-back function to be called any
...@@ -1114,85 +1109,7 @@ CloseDownClient(register ClientPtr client) ...@@ -1114,85 +1109,7 @@ CloseDownClient(register ClientPtr client)
nxagentCheckIfShadowAgent(client); nxagentCheckIfShadowAgent(client);
if (!client->clientGone) xorg_CloseDownClient(client);
{
/* ungrab server if grabbing client dies */
if (grabState != GrabNone && grabClient == client)
{
UngrabServer(client);
}
BITCLEAR(grabWaiters, client->index);
DeleteClientFromAnySelections(client);
ReleaseActiveGrabs(client);
DeleteClientFontStuff(client);
if (!really_close_down)
{
/* This frees resources that should never be retained
* no matter what the close down mode is. Actually we
* could do this unconditionally, but it's probably
* better not to traverse all the client's resources
* twice (once here, once a few lines down in
* FreeClientResources) in the common case of
* really_close_down == TRUE.
*/
FreeClientNeverRetainResources(client);
client->clientState = ClientStateRetained;
if (ClientStateCallback)
{
NewClientInfoRec clientinfo;
clientinfo.client = client;
clientinfo.prefix = (xConnSetupPrefix *)NULL;
clientinfo.setup = (xConnSetup *) NULL;
CallCallbacks((&ClientStateCallback), (void *)&clientinfo);
}
}
client->clientGone = TRUE; /* so events aren't sent to client */
if (ClientIsAsleep(client))
ClientSignal (client);
ProcessWorkQueueZombies();
CloseDownConnection(client);
/* If the client made it to the Running stage, nClients has
* been incremented on its behalf, so we need to decrement it
* now. If it hasn't gotten to Running, nClients has *not*
* been incremented, so *don't* decrement it.
*/
if (client->clientState != ClientStateInitial &&
client->clientState != ClientStateAuthenticating )
{
--nClients;
}
}
if (really_close_down)
{
if (client->clientState == ClientStateRunning && nClients == 0)
dispatchException |= dispatchExceptionAtReset;
client->clientState = ClientStateGone;
if (ClientStateCallback)
{
NewClientInfoRec clientinfo;
clientinfo.client = client;
clientinfo.prefix = (xConnSetupPrefix *)NULL;
clientinfo.setup = (xConnSetup *) NULL;
CallCallbacks((&ClientStateCallback), (void *)&clientinfo);
}
FreeClientResources(client);
/* Disable client ID tracking. This must be done after
* ClientStateCallback. */
ReleaseClientIds(client);
if (client->index < nextFreeClientID)
nextFreeClientID = client->index;
clients[client->index] = NullClient;
SmartLastClient = NullClient;
free(client);
while (!clients[currentMaxClients-1])
currentMaxClients--;
}
} }
int int
......
Markdown is supported
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