diff options
author | sumikawa <sumikawa@FreeBSD.org> | 2002-03-29 07:03:57 +0000 |
---|---|---|
committer | sumikawa <sumikawa@FreeBSD.org> | 2002-03-29 07:03:57 +0000 |
commit | 218188767027b7fa7a517390a13b19bc47b897ac (patch) | |
tree | 544ab0e312f138ca4e2718a1bae9a196080ad1b5 /www/mozilla-devel | |
parent | c9bbf89fcd91b135997d8b0567747e621b03d4a4 (diff) | |
download | FreeBSD-ports-218188767027b7fa7a517390a13b19bc47b897ac.zip FreeBSD-ports-218188767027b7fa7a517390a13b19bc47b897ac.tar.gz |
Multiple IP trying works not only when connection resused but also
when timeout. This patch was already commited in mozilla-current
and will appear in mozilla-1.0.
Obtained from: Bugzilla/126755
http://bugzilla.mozilla.org/show_bug.cgi?id=126755
Diffstat (limited to 'www/mozilla-devel')
3 files changed, 101 insertions, 1 deletions
diff --git a/www/mozilla-devel/Makefile b/www/mozilla-devel/Makefile index 0d5c55d..c8b1ac8 100644 --- a/www/mozilla-devel/Makefile +++ b/www/mozilla-devel/Makefile @@ -7,7 +7,7 @@ PORTNAME= mozilla PORTVERSION= 0.9.9 -PORTREVISION= 2 +PORTREVISION= 3 PORTEPOCH= 1 CATEGORIES= www MASTER_SITES= ${MASTER_SITE_MOZILLA} \ diff --git a/www/mozilla-devel/files/patch-netwerk::base::src::nsSocketTransport.cpp b/www/mozilla-devel/files/patch-netwerk::base::src::nsSocketTransport.cpp new file mode 100644 index 0000000..cb0b363 --- /dev/null +++ b/www/mozilla-devel/files/patch-netwerk::base::src::nsSocketTransport.cpp @@ -0,0 +1,80 @@ +--- netwerk/base/src/nsSocketTransport.cpp.orig Thu Feb 7 11:26:46 2002 ++++ netwerk/base/src/nsSocketTransport.cpp Thu Mar 21 12:24:23 2002 +@@ -513,21 +513,8 @@ + + // on connection failure, reuse next address if one exists + if (mStatus == NS_ERROR_CONNECTION_REFUSED) { +- mNetAddress = mNetAddrList.GetNext(mNetAddress); +- if (mNetAddress) { +-#if defined(PR_LOGGING) +- char buf[50]; +- PR_NetAddrToString(mNetAddress, buf, sizeof(buf)); +- LOG(("connection failed... trying %s\n", buf)); +-#endif +- PR_Close(mSocketFD); +- mSocketFD = nsnull; +- +- // mask error status so we'll return to this state +- mStatus = NS_OK; +- +- // need to re-enter Process() asynchronously +- mService->AddToWorkQ(this); ++ LOG(("connection failed [this=%x error=%x]\n", this, mStatus)); ++ if (TryNextAddress()) { + done = PR_TRUE; + continue; + } +@@ -545,6 +532,23 @@ + LOG(("nsSocketTransport: Transport [host=%s:%d this=%x] is in Timeout state.\n", + mHostName, mPort, this)); + mStatus = NS_ERROR_NET_TIMEOUT; ++ ++ // on timeout, reuse next address if one exists ... do this only ++ // if we haven't already fired OnStartRequest. ++ if (mReadRequest || mWriteRequest) { ++ PRBool firedOnStart = PR_TRUE; // initial value doesn't matter ++ if (mReadRequest) ++ firedOnStart = mReadRequest->IsInitialized(); ++ if (!firedOnStart && mWriteRequest) ++ firedOnStart = mWriteRequest->IsInitialized(); ++ if (!firedOnStart && TryNextAddress()) { ++ // a little bit of hackery here so we'll end up in the ++ // WaitConnect state... ++ mCurrentState = eSocketState_WaitConnect; ++ done = PR_TRUE; ++ continue; ++ } ++ } + break; + + default: +@@ -591,6 +595,29 @@ + if (mWriteRequest) + mWriteRequest->Cancel(status); + return NS_OK; ++} ++ ++PRBool ++nsSocketTransport::TryNextAddress() ++{ ++ mNetAddress = mNetAddrList.GetNext(mNetAddress); ++ if (mNetAddress) { ++#if defined(PR_LOGGING) ++ char buf[64]; ++ PR_NetAddrToString(mNetAddress, buf, sizeof(buf)); ++ LOG((" ...trying next address: %s\n", buf)); ++#endif ++ PR_Close(mSocketFD); ++ mSocketFD = nsnull; ++ ++ // mask error status so we'll return to this state ++ mStatus = NS_OK; ++ ++ // need to re-enter Process() asynchronously ++ mService->AddToWorkQ(this); ++ return PR_TRUE; ++ } ++ return PR_FALSE; + } + + void diff --git a/www/mozilla-devel/files/patch-netwerk::base::src::nsSocketTransport.h b/www/mozilla-devel/files/patch-netwerk::base::src::nsSocketTransport.h new file mode 100644 index 0000000..d86e5eb --- /dev/null +++ b/www/mozilla-devel/files/patch-netwerk::base::src::nsSocketTransport.h @@ -0,0 +1,20 @@ +--- netwerk/base/src/nsSocketTransport.h.orig Sat Feb 2 11:45:25 2002 ++++ netwerk/base/src/nsSocketTransport.h Thu Mar 21 12:24:26 2002 +@@ -208,6 +208,8 @@ + nsresult doReadWrite(PRInt16 aSelectFlags); + nsresult doResolveHost(); + ++ PRBool TryNextAddress(); ++ + void CompleteAsyncRead(); + void CompleteAsyncWrite(); + +@@ -378,7 +380,7 @@ + + void SetSocket(PRFileDesc *aSock) { mSock = aSock; } + PRUint32 GetOffset() { return mOffset; } +- void SetOffset(PRUint32 o) { mOffset = o; } ++ void SetOffset(PRUint32 offset) { mOffset = offset; } + PRBool GotWouldBlock() { return mError == PR_WOULD_BLOCK_ERROR; } + PRBool GotError() { return mError != 0; } + PRErrorCode GetError() { return mError; } |