reassign 385976 xtrans
tag 385976 + patch
stop

        Hi,

 Please find a proposed patch attached (both the patch for the Debian
 package and the actual patch file are attached).  (Reassigning to
 xtrans because it's what the patch is against.)

   Bye,
-- 
Loïc Minier <[EMAIL PROTECTED]>
diff -urN xtrans-1.0.1.orig/Xtranssock.c xtrans-1.0.1/Xtranssock.c
--- xtrans-1.0.1.orig/Xtranssock.c      2006-06-16 00:53:55.000000000 +0200
+++ xtrans-1.0.1/Xtranssock.c   2006-09-12 19:14:13.000000000 +0200
@@ -2041,8 +2041,13 @@
            errno = olderrno;
            
            /*
-            * If the error was ENOENT, the server may be starting up
-            * and we should try again.
+            * If the error was ENOENT, the server may be starting up; we used
+            * to suggest to try again in this case with
+            * TRANS_TRY_CONNECT_AGAIN, but this introduced problems for
+            * processes still referencing stale sockets in their environment.
+            * Hence, we now return a hard error, TRANS_CONNECT_FAILED, and it
+            * is suggested that higher level stacks handle retries on their
+            * level when they face a slow starting server.
             *
             * If the error was EWOULDBLOCK or EINPROGRESS then the socket
             * was non-blocking and we should poll using select
@@ -2051,7 +2056,9 @@
             * should try again.
             */
 
-           if (olderrno == ENOENT || olderrno == EINTR)
+           if (olderrno == ENOENT)
+               return TRANS_CONNECT_FAILED;
+           else if (olderrno == EINTR)
                return TRANS_TRY_CONNECT_AGAIN;
            else if (olderrno == EWOULDBLOCK || olderrno == EINPROGRESS)
                return TRANS_IN_PROGRESS;
--- xtrans-1.0.1/debian/patches/series
+++ xtrans-1.0.1/debian/patches/series
@@ -2,0 +3 @@
+03_unix-sock-fail-fast.diff -p1
--- xtrans-1.0.1/debian/changelog
+++ xtrans-1.0.1/debian/changelog
@@ -1,3 +1,11 @@
+xtrans (1.0.1-3) unstable; urgency=low
+
+  * New patch, 03_unix-sock-fail-fast, to fail immediately in case a UNIX
+    socket doesn't exist; higher level stacks should retry the connection with
+    the server if they face slow starting servers. (Closes: #385976)
+
+ -- Loic Minier <[EMAIL PROTECTED]>  Tue, 12 Sep 2006 19:14:20 +0200
+
 xtrans (1.0.1-2) unstable; urgency=low
 
   [ Andres Salomon ]
--- xtrans-1.0.1.orig/Xtranssock.c
+++ xtrans-1.0.1/Xtranssock.c
@@ -2041,8 +2041,13 @@
            errno = olderrno;
            
            /*
-            * If the error was ENOENT, the server may be starting up
-            * and we should try again.
+            * If the error was ENOENT, the server may be starting up; we used
+            * to suggest to try again in this case with
+            * TRANS_TRY_CONNECT_AGAIN, but this introduced problems for
+            * processes still referencing stale sockets in their environment.
+            * Hence, we now return a hard error, TRANS_CONNECT_FAILED, and it
+            * is suggested that higher level stacks handle retries on their
+            * level when they face a slow starting server.
             *
             * If the error was EWOULDBLOCK or EINPROGRESS then the socket
             * was non-blocking and we should poll using select
@@ -2051,7 +2056,9 @@
             * should try again.
             */
 
-           if (olderrno == ENOENT || olderrno == EINTR)
+           if (olderrno == ENOENT)
+               return TRANS_CONNECT_FAILED;
+           else if (olderrno == EINTR)
                return TRANS_TRY_CONNECT_AGAIN;
            else if (olderrno == EWOULDBLOCK || olderrno == EINPROGRESS)
                return TRANS_IN_PROGRESS;
--- xtrans-1.0.1.orig/debian/patches/03_unix-sock-fail-fast.diff
+++ xtrans-1.0.1/debian/patches/03_unix-sock-fail-fast.diff
@@ -0,0 +1,30 @@
+diff -urN xtrans-1.0.1.orig/Xtranssock.c xtrans-1.0.1/Xtranssock.c
+--- xtrans-1.0.1.orig/Xtranssock.c     2006-06-16 00:53:55.000000000 +0200
++++ xtrans-1.0.1/Xtranssock.c  2006-09-12 19:14:13.000000000 +0200
+@@ -2041,8 +2041,13 @@
+           errno = olderrno;
+           
+           /*
+-           * If the error was ENOENT, the server may be starting up
+-           * and we should try again.
++           * If the error was ENOENT, the server may be starting up; we used
++           * to suggest to try again in this case with
++           * TRANS_TRY_CONNECT_AGAIN, but this introduced problems for
++           * processes still referencing stale sockets in their environment.
++           * Hence, we now return a hard error, TRANS_CONNECT_FAILED, and it
++           * is suggested that higher level stacks handle retries on their
++           * level when they face a slow starting server.
+            *
+            * If the error was EWOULDBLOCK or EINPROGRESS then the socket
+            * was non-blocking and we should poll using select
+@@ -2051,7 +2056,9 @@
+            * should try again.
+            */
+ 
+-          if (olderrno == ENOENT || olderrno == EINTR)
++          if (olderrno == ENOENT)
++              return TRANS_CONNECT_FAILED;
++          else if (olderrno == EINTR)
+               return TRANS_TRY_CONNECT_AGAIN;
+           else if (olderrno == EWOULDBLOCK || olderrno == EINPROGRESS)
+               return TRANS_IN_PROGRESS;

Reply via email to