Bug 684893 - part2: Happy-Eyeballs + let backup socket transport retry with both IPv4+6 on IPv6-only connection attempt failure, r=mcmanus

This commit is contained in:
Honza Bambas 2011-11-02 17:18:54 +01:00
Родитель 35a08e28d5
Коммит 709ddbf93e
2 изменённых файлов: 22 добавлений и 2 удалений

Просмотреть файл

@ -791,7 +791,7 @@ pref("network.http.connection-retry-timeout", 250);
// Disable IPv6 for backup connections to workaround problems about broken
// IPv6 connectivity.
pref("network.http.fast-fallback-to-IPv4", false);
pref("network.http.fast-fallback-to-IPv4", true);
// default values for FTP
// in a DSCP environment this should be 40 (0x28, or AF11), per RFC-4594,

Просмотреть файл

@ -1257,6 +1257,8 @@ nsSocketTransport::RecoverFromError()
if (mState != STATE_RESOLVING && mState != STATE_CONNECTING)
return false;
nsresult rv;
// OK to check this outside mLock
NS_ASSERTION(!mFDconnected, "socket should not be connected");
@ -1270,6 +1272,15 @@ nsSocketTransport::RecoverFromError()
bool tryAgain = false;
if (mConnectionFlags & DISABLE_IPV6 &&
mCondition == NS_ERROR_UNKNOWN_HOST &&
mState == STATE_RESOLVING &&
!mProxyTransparentResolvesHost) {
SOCKET_LOG((" trying lookup again with both ipv4/ipv6 enabled\n"));
mConnectionFlags &= ~DISABLE_IPV6;
tryAgain = true;
}
// try next ip address only if past the resolver stage...
if (mState == STATE_CONNECTING && mDNSRecord) {
mDNSRecord->ReportUnusable(SocketPort());
@ -1279,6 +1290,16 @@ nsSocketTransport::RecoverFromError()
SOCKET_LOG((" trying again with next ip address\n"));
tryAgain = true;
}
else if (mConnectionFlags & DISABLE_IPV6) {
// Drop state to closed. This will trigger new round of DNS
// resolving bellow.
// XXX Here should idealy be set now non-existing flag DISABLE_IPV4
SOCKET_LOG((" failed to connect all ipv4 hosts,"
" trying lookup/connect again with both ipv4/ipv6\n"));
mState = STATE_CLOSED;
mConnectionFlags &= ~DISABLE_IPV6;
tryAgain = true;
}
}
#if defined(XP_WIN) || defined(MOZ_PLATFORM_MAEMO)
@ -1296,7 +1317,6 @@ nsSocketTransport::RecoverFromError()
// prepare to try again.
if (tryAgain) {
nsresult rv;
PRUint32 msg;
if (mState == STATE_CONNECTING) {