os: Remove CheckConnections
poll provides per-fd notification of failure, so we don't need CheckConnections anymore. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
parent
f0275b1e5a
commit
50779c494d
|
@ -141,8 +141,6 @@ extern _X_EXPORT const char *ClientAuthorized(ClientPtr /*client */ ,
|
|||
unsigned int /*string_n */ ,
|
||||
char * /*auth_string */ );
|
||||
|
||||
extern _X_EXPORT void CheckConnections(void);
|
||||
|
||||
extern _X_EXPORT void CloseDownConnection(ClientPtr /*client */ );
|
||||
|
||||
typedef void (*NotifyFdProcPtr)(int fd, int ready, void *data);
|
||||
|
|
|
@ -206,11 +206,7 @@ WaitForSomething(Bool are_ready)
|
|||
if (dispatchException)
|
||||
return FALSE;
|
||||
if (i < 0) {
|
||||
if (pollerr == EBADF) { /* Some client disconnected */
|
||||
CheckConnections();
|
||||
return FALSE;
|
||||
}
|
||||
else if (pollerr == EINVAL) {
|
||||
if (pollerr == EINVAL) {
|
||||
FatalError("WaitForSomething(): poll: %s\n",
|
||||
strerror(pollerr));
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ SOFTWARE.
|
|||
* Stuff to create connections --- OS dependent
|
||||
*
|
||||
* EstablishNewConnections, CreateWellKnownSockets, ResetWellKnownSockets,
|
||||
* CloseDownConnection, CheckConnections
|
||||
* CloseDownConnection,
|
||||
* OnlyListToOneClient,
|
||||
* ListenToAllClients,
|
||||
*
|
||||
|
@ -78,7 +78,6 @@ SOFTWARE.
|
|||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <poll.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <sys/socket.h>
|
||||
|
@ -898,39 +897,6 @@ CloseDownFileDescriptor(OsCommPtr oc)
|
|||
ospoll_remove(server_poll, connection);
|
||||
}
|
||||
|
||||
/*****************
|
||||
* CheckConnections
|
||||
* Some connection has died, go find which one and shut it down
|
||||
* The file descriptor has been closed, but is still in AllClients.
|
||||
* If would truly be wonderful if select() would put the bogus
|
||||
* file descriptors in the exception mask, but nooooo. So we have
|
||||
* to check each and every socket individually.
|
||||
*****************/
|
||||
|
||||
void
|
||||
CheckConnections(void)
|
||||
{
|
||||
int i;
|
||||
int r;
|
||||
|
||||
for (i = 1; i < currentMaxClients; i++) {
|
||||
ClientPtr client = clients[i];
|
||||
if (!client->clientGone) {
|
||||
OsCommPtr oc = (OsCommPtr) client->osPrivate;
|
||||
struct pollfd poll_fd;
|
||||
|
||||
poll_fd.fd = oc->fd;
|
||||
poll_fd.events = POLLIN|POLLOUT;
|
||||
|
||||
do {
|
||||
r = poll(&poll_fd, 1, 0);
|
||||
} while (r < 0 && (errno == EINTR || errno == EAGAIN));
|
||||
if (r < 0)
|
||||
CloseDownClient(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************
|
||||
* CloseDownConnection
|
||||
* Delete client from AllClients and free resources
|
||||
|
|
Loading…
Reference in New Issue
Block a user