michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsNativeConnectionHelper.h" michael@0: #include "nsAutodialWin.h" michael@0: #include "nsIOService.h" michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: // API typically invoked on the socket transport thread michael@0: //----------------------------------------------------------------------------- michael@0: michael@0: bool michael@0: nsNativeConnectionHelper::OnConnectionFailed(const char16_t* hostName) michael@0: { michael@0: if (gIOService->IsLinkUp()) michael@0: return false; michael@0: michael@0: nsAutodial autodial; michael@0: if (autodial.ShouldDialOnNetworkError()) michael@0: return NS_SUCCEEDED(autodial.DialDefault(hostName)); michael@0: michael@0: return false; michael@0: } michael@0: michael@0: bool michael@0: nsNativeConnectionHelper::IsAutodialEnabled() michael@0: { michael@0: nsAutodial autodial; michael@0: return autodial.Init() == NS_OK && autodial.ShouldDialOnNetworkError(); michael@0: }