os: Establish new connections synchronously not on the work queue
This contortion made a bit more sense before we got SetNotifyFd and friends, but now there's no need for it. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
69d8ea4a49
commit
23752b3ef8
|
@ -133,7 +133,7 @@ static Pid_t ParentProcess;
|
|||
int GrabInProgress = 0;
|
||||
|
||||
static void
|
||||
QueueNewConnections(int curconn, int ready, void *data);
|
||||
EstablishNewConnections(int curconn, int ready, void *data);
|
||||
|
||||
static void
|
||||
set_poll_client(ClientPtr client);
|
||||
|
@ -270,7 +270,7 @@ CreateWellKnownSockets(void)
|
|||
int fd = _XSERVTransGetConnectionNumber(ListenTransConns[i]);
|
||||
|
||||
ListenTransFds[i] = fd;
|
||||
SetNotifyFd(fd, QueueNewConnections, X_NOTIFY_READ, NULL);
|
||||
SetNotifyFd(fd, EstablishNewConnections, X_NOTIFY_READ, NULL);
|
||||
|
||||
if (!_XSERVTransIsLocal(ListenTransConns[i]))
|
||||
DefineSelf (fd);
|
||||
|
@ -330,7 +330,8 @@ ResetWellKnownSockets(void)
|
|||
}
|
||||
}
|
||||
for (i = 0; i < ListenTransCount; i++)
|
||||
SetNotifyFd(ListenTransFds[i], QueueNewConnections, X_NOTIFY_READ, NULL);
|
||||
SetNotifyFd(ListenTransFds[i], EstablishNewConnections, X_NOTIFY_READ,
|
||||
NULL);
|
||||
|
||||
ResetAuthorization();
|
||||
ResetHosts(display);
|
||||
|
@ -638,14 +639,12 @@ AllocNewConnection(XtransConnInfo trans_conn, int fd, CARD32 conn_time)
|
|||
/*****************
|
||||
* EstablishNewConnections
|
||||
* If anyone is waiting on listened sockets, accept them.
|
||||
* Returns a mask with indices of new clients. Updates AllClients
|
||||
* and AllSockets.
|
||||
* Updates AllClients and AllSockets.
|
||||
*****************/
|
||||
|
||||
static Bool
|
||||
EstablishNewConnections(ClientPtr clientUnused, void *closure)
|
||||
static void
|
||||
EstablishNewConnections(int curconn, int ready, void *data)
|
||||
{
|
||||
int curconn = (int) (intptr_t) closure;
|
||||
int newconn; /* fd of new client */
|
||||
CARD32 connect_time;
|
||||
int i;
|
||||
|
@ -667,10 +666,10 @@ EstablishNewConnections(ClientPtr clientUnused, void *closure)
|
|||
}
|
||||
|
||||
if ((trans_conn = lookup_trans_conn(curconn)) == NULL)
|
||||
return TRUE;
|
||||
return;
|
||||
|
||||
if ((new_trans_conn = _XSERVTransAccept(trans_conn, &status)) == NULL)
|
||||
return TRUE;
|
||||
return;
|
||||
|
||||
newconn = _XSERVTransGetConnectionNumber(new_trans_conn);
|
||||
|
||||
|
@ -682,13 +681,7 @@ EstablishNewConnections(ClientPtr clientUnused, void *closure)
|
|||
if (!AllocNewConnection(new_trans_conn, newconn, connect_time)) {
|
||||
ErrorConnMax(new_trans_conn);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
QueueNewConnections(int fd, int ready, void *data)
|
||||
{
|
||||
QueueWorkProc(EstablishNewConnections, NULL, (void *) (intptr_t) fd);
|
||||
return;
|
||||
}
|
||||
|
||||
#define NOROOM "Maximum number of clients reached"
|
||||
|
@ -1015,7 +1008,7 @@ ListenOnOpenFD(int fd, int noxauth)
|
|||
ListenTransConns[ListenTransCount] = ciptr;
|
||||
ListenTransFds[ListenTransCount] = fd;
|
||||
|
||||
SetNotifyFd(fd, QueueNewConnections, X_NOTIFY_READ, NULL);
|
||||
SetNotifyFd(fd, EstablishNewConnections, X_NOTIFY_READ, NULL);
|
||||
|
||||
/* Increment the count */
|
||||
ListenTransCount++;
|
||||
|
|
Loading…
Reference in New Issue
Block a user