summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fd.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/fd.c b/fd.c
index b616193..33367ac 100644
--- a/fd.c
+++ b/fd.c
@@ -270,20 +270,30 @@ MakeConnection(
int connect_stat;
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");
+
+ enterprocedure("ConnectToServer");
+ s = protocols;
+ while (*s) {
+ *trans_conn = NULL;
+ snprintf (address, sizeof(address), "%s/%s:%ld", *s++, server, port - ServerBasePort);
+ debug(4,(stderr, "Trying %s ", address));
+ *trans_conn = _X11TransOpenCOTSClient(address);
+ if(*trans_conn == NULL) {
+ debug(1,(stderr, "OpenCOTSClient %s failed\n", address));
+ continue;
+ }
+ debug(4,(stderr, "Opened "));
+ if ((connect_stat = _X11TransConnect(*trans_conn,address)) < 0 ) {
+ _X11TransClose(*trans_conn);
+ *trans_conn = NULL;
+ debug(1,(stderr, "TransConnect %s failed\n", address));
+ continue;
+ }
+ debug(4,(stderr, "Connected\n"));
+ break;
}
- if ((connect_stat = _X11TransConnect(*trans_conn,address)) < 0 ) {
- _X11TransClose(*trans_conn);
- *trans_conn = NULL;
- debug(1,(stderr, "TransConnect failed\n"));
- panic("Can't open connection to Server");
+ if (*trans_conn == NULL) {
+ panic("Can't open connection to Server");
}
ServerFD = _X11TransGetConnectionNumber(*trans_conn);