[PATCH xscope] Fallback on other transports
Jeremy Huddleston
jeremyhu at apple.com
Wed May 12 18:15:16 PDT 2010
This adds support for --disable-unix-transport
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
---
fd.c | 13 +++++++++----
fd.h | 2 +-
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/fd.c b/fd.c
index 0945d41..fbf48ec 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", "inet6", "inet", "tcp", 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);
--
1.7.1
More information about the xorg-devel
mailing list