summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2010-05-12 18:12:37 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2010-05-14 13:04:40 -0700
commit26db4f6adf5a43f49b7941bab90c05c1e271d6b0 (patch)
tree3ab313848f34a515717564855eb16afa177e1ebd
parentdf598a664bf5c22e9fa55a15f38780c55cac47d2 (diff)
Fallback on other transports.
This adds support for --disable-unix-transport Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--fd.c13
-rw-r--r--fd.h2
2 files changed, 10 insertions, 5 deletions
diff --git a/fd.c b/fd.c
index 0945d41..0298727 100644
--- a/fd.c
+++ b/fd.c
@@ -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");
}
diff --git a/fd.h b/fd.h
index 70e437d..3815210 100644
--- a/fd.h
+++ b/fd.h
@@ -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);