[PATCH app-xscope] Retry _X11TransConnect on TRANS_TRY_CONNECT_AGAIN

Jeff Smith whydoubt at yahoo.com
Wed Jul 28 13:29:56 PDT 2010


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 <whydoubt at yahoo.com>
---
 fd.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/fd.c b/fd.c
index 0298727..d0a2270 100644
--- a/fd.c
+++ b/fd.c
@@ -280,10 +280,13 @@ MakeConnection(
       panic("Can't open connection to Server");
   }
   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 ((connect_stat != TRANS_TRY_CONNECT_AGAIN) ||
+              (_X11TransConnect(*trans_conn,address) < 0 )) {
+          _X11TransClose(*trans_conn);
+          *trans_conn = NULL;
+          debug(1,(stderr, "TransConnect failed\n"));
+          panic("Can't open connection to Server");
+      }
   }
 
   ServerFD = _X11TransGetConnectionNumber(*trans_conn);
-- 
1.7.0

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the xorg-devel mailing list