aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os/connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/os/connection.c')
-rw-r--r--xorg-server/os/connection.c59
1 files changed, 46 insertions, 13 deletions
diff --git a/xorg-server/os/connection.c b/xorg-server/os/connection.c
index 4eb2c15c7..a95ab0343 100644
--- a/xorg-server/os/connection.c
+++ b/xorg-server/os/connection.c
@@ -67,6 +67,9 @@ SOFTWARE.
#ifdef WIN32
#include <X11/Xwinsock.h>
+#ifdef _DEBUG
+#define DEBUG
+#endif
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
@@ -111,6 +114,10 @@ SOFTWARE.
#include "dixstruct.h"
#include "xace.h"
+#ifdef _MSC_VER
+typedef int pid_t;
+#endif
+
#define Pid_t pid_t
@@ -269,6 +276,23 @@ lookup_trans_conn (int fd)
return NULL;
}
+int
+TransIsListening(char *protocol)
+{
+ /* look for this transport in the list of listeners */
+ int i;
+ for (i = 0; i < ListenTransCount; i++)
+ {
+ if (!strcmp(protocol, ListenTransConns[i]->transptr->TransName))
+ {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+
/* Set MaxClients and lastfdesc, and allocate ConnectionTranslation */
void
@@ -976,7 +1000,8 @@ CheckConnections(void)
struct timeval notime;
int r;
#ifdef WIN32
- fd_set savedAllClients;
+ fd_set savedAllSockets;
+ unsigned j;
#endif
notime.tv_sec = 0;
@@ -1002,19 +1027,23 @@ CheckConnections(void)
}
}
#else
- XFD_COPYSET(&AllClients, &savedAllClients);
- for (i = 0; i < XFD_SETCOUNT(&savedAllClients); i++)
+ XFD_COPYSET(&AllSockets, &savedAllSockets);
+ for (j=0; j<2; j++)
{
- curclient = XFD_FD(&savedAllClients, i);
- FD_ZERO(&tmask);
- FD_SET(curclient, &tmask);
- do {
- r = Select (curclient + 1, &tmask, NULL, NULL, &notime);
- } while (r < 0 && (errno == EINTR || errno == EAGAIN));
- if (r < 0)
- if (GetConnectionTranslation(curclient) > 0)
- CloseDownClient(clients[GetConnectionTranslation(curclient)]);
- }
+ for (i = 0; i < XFD_SETCOUNT(&savedAllSockets); i++)
+ {
+ curclient = XFD_FD(&savedAllSockets, i);
+ FD_ZERO(&tmask);
+ FD_SET(curclient, &tmask);
+ do {
+ r = Select (curclient + 1, &tmask, NULL, NULL, &notime);
+ } while (r < 0 && (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEWOULDBLOCK));
+ if (r < 0)
+ if (GetConnectionTranslation(curclient) > 0)
+ CloseDownClient(clients[GetConnectionTranslation(curclient)]);
+ }
+ XFD_COPYSET(&AllClients, &savedAllSockets);
+ }
#endif
}
@@ -1032,6 +1061,10 @@ CloseDownConnection(ClientPtr client)
if (FlushCallback)
CallCallbacks(&FlushCallback, NULL);
+#ifdef DEBUG
+ ErrorF("CloseDownConnection: client index = %d, socket fd = %d\n",
+ client->index, oc->fd);
+#endif
if (oc->output && oc->output->count)
FlushClient(client, oc, (char *)NULL, 0);
#ifdef XDMCP