diff options
author | Jeremy Huddleston <jeremyhu@apple.com> | 2010-05-12 18:12:37 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2010-05-14 13:04:40 -0700 |
commit | 26db4f6adf5a43f49b7941bab90c05c1e271d6b0 (patch) | |
tree | 3ab313848f34a515717564855eb16afa177e1ebd | |
parent | df598a664bf5c22e9fa55a15f38780c55cac47d2 (diff) |
Fallback on other transports.
This adds support for --disable-unix-transport
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r-- | fd.c | 13 | ||||
-rw-r--r-- | fd.h | 2 |
2 files changed, 10 insertions, 5 deletions
@@ -258,7 +258,7 @@ AcceptConnection ( FD MakeConnection( - char *server, + const char *server, short port, int report, XtransConnInfo *trans_conn /* transport connection object */ @@ -268,9 +268,14 @@ MakeConnection( #ifdef USE_XTRANS char address[256]; int connect_stat; - - snprintf (address, sizeof(address), "%s:%ld", server, port - ServerBasePort); - if ( (*trans_conn = _X11TransOpenCOTSClient(address)) == NULL ) { + const char *protocols[] = {"local", "unix", "tcp", "inet6", "inet", NULL}; + const char **s; + + for(*trans_conn = NULL, s = protocols; *trans_conn == NULL && *s; s++) { + snprintf (address, sizeof(address), "%s/%s:%ld", *s, server, port - ServerBasePort); + *trans_conn = _X11TransOpenCOTSClient(address); + } + if(*trans_conn == NULL) { debug(1,(stderr, "OpenCOTSClient failed\n")); panic("Can't open connection to Server"); } @@ -96,7 +96,7 @@ extern void UsingFD(FD fd, void (*Handler)(int), void (*FlushHandler)(int), extern void NotUsingFD(FD fd); extern FD AcceptConnection (FD ConnectionSocket); -extern FD MakeConnection (char *server, short port, int report, +extern FD MakeConnection (const char *server, short port, int report, XtransConnInfo *trans_conn); extern int MainLoop(void); |