Bug 1311044 - show error when connection to domain socket is failed; r=bagder
authorLiang-Heng Chen <xeonchen@mozilla.com>
Wed, 19 Oct 2016 18:28:02 +0800
changeset 318759 df49275ec24cf78028bcba9ecdd85334350c19f8
parent 318758 4adb7daf5033d99baf8c55483ea7d628f4693424
child 318760 c249f55213b6acad8f39579d732a2fc0745e0d47
push id30852
push usercbook@mozilla.com
push dateFri, 21 Oct 2016 14:55:15 +0000
treeherdermozilla-central@fcadf6ec5ccf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbagder
bugs1311044
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1311044 - show error when connection to domain socket is failed; r=bagder MozReview-Commit-ID: GtqKiMVwQyX
netwerk/socket/nsSOCKSIOLayer.cpp
--- a/netwerk/socket/nsSOCKSIOLayer.cpp
+++ b/netwerk/socket/nsSOCKSIOLayer.cpp
@@ -508,20 +508,26 @@ nsSOCKSSocketInfo::ConnectToProxy(PRFile
 
         NetAddr proxy = mInternalProxyAddr;
         FixupAddressFamily(fd, &proxy);
         PRNetAddr prProxy;
         NetAddrToPRNetAddr(&proxy, &prProxy);
         status = fd->lower->methods->connect(fd->lower, &prProxy, mTimeout);
         if (status != PR_SUCCESS) {
             PRErrorCode c = PR_GetError();
+
             // If EINPROGRESS, return now and check back later after polling
             if (c == PR_WOULD_BLOCK_ERROR || c == PR_IN_PROGRESS_ERROR) {
                 mState = SOCKS_CONNECTING_TO_PROXY;
                 return status;
+            } else if (IsHostDomainSocket()) {
+                LOGERROR(("socks: connect to domain socket failed (%d)", c));
+                PR_SetError(PR_CONNECT_REFUSED_ERROR, 0);
+                mState = SOCKS_FAILED;
+                return status;
             }
         }
     } while (status != PR_SUCCESS);
 
     // Connected now, start SOCKS
     if (mVersion == 4)
         return WriteV4ConnectRequest();
     return WriteV5AuthRequest();