[PATCH xscope] Try _X11TransConnect again if it returns TRANS_TRY_CONNECT_AGAIN the first time.

Jeff Smith whydoubt at yahoo.com
Tue Jun 22 12:04:59 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>
---


Sorry about the first email with the missing project name.


 fd.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/fd.c b/fd.c
index 0298727..26e68c4 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.6.0.6

__________________________________________________
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