diff options
author | Adam Jackson <ajax@redhat.com> | 2018-10-25 13:13:13 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2018-11-13 10:36:40 -0500 |
commit | 23752b3ef889ada7b705c51f478f5817e5caaed3 (patch) | |
tree | fd3fe99bf1af3a12f45353a45dbd50e4e1afa3fa /os | |
parent | 69d8ea4a49793a94f821d1a328856901a1c02a5a (diff) |
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>
Diffstat (limited to 'os')
-rw-r--r-- | os/connection.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/os/connection.c b/os/connection.c index de9696ec8..fd4f9c0ed 100644 --- a/os/connection.c +++ b/os/connection.c @@ -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++; |