From 670016475f1d7833bca5206a4d46704db36bccdb Mon Sep 17 00:00:00 2001 From: Jeff Smith Date: Wed, 28 Jul 2010 15:29:56 -0500 Subject: Retry _X11TransConnect on TRANS_TRY_CONNECT_AGAIN Reading through Xtranssock.c reveals that when _X11TransConnect returns the value TRANS_TRY_CONNECT_AGAIN, it turns off the abstract socket flag, so that attempting _X11TransConnect might succeed the second time where it failed the first time. Now xscope will attempt the connection a second time when it receives the TRANS_TRY_CONNECT_AGAIN return value on the first connection attempt. Signed-off-by: Jeff Smith Reviewed-by: Alan Coopersmith Signed-off-by: Alan Coopersmith --- fd.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fd.c b/fd.c index 33367ac..9cf8026 100644 --- a/fd.c +++ b/fd.c @@ -284,10 +284,13 @@ MakeConnection( } 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; + if ((connect_stat != TRANS_TRY_CONNECT_AGAIN) || + (_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; -- cgit v1.2.1