From: Michael Vogt <michael.vogt@ubuntu.com>
Date: Fri, 8 Feb 2008 11:30:54 +0000 (+0100)
Subject: * methods/connect.cc:
X-Git-Tag: 0.7.24ubuntu1~99
X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/1b7fe0e12c7553e0efc90ca6922caecb8d5cbb07

* methods/connect.cc:
  - remember hosts with Resolve failures or connect Timeouts
    see https://wiki.ubuntu.com/NetworklessInstallationFixes
---

1b7fe0e12c7553e0efc90ca6922caecb8d5cbb07
diff --cc configure.in
index fb9f0fc5c,5f19c98a6..8dac41bb8
--- a/configure.in
+++ b/configure.in
@@@ -18,7 -18,7 +18,7 @@@ AC_CONFIG_AUX_DIR(buildlib
  AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
  
  dnl -- SET THIS TO THE RELEASE VERSION --
- AC_DEFINE_UNQUOTED(VERSION,"0.7.9ubuntu6")
 -AC_DEFINE_UNQUOTED(VERSION,"0.7.10")
++AC_DEFINE_UNQUOTED(VERSION,"0.7.9ubuntu7")
  PACKAGE="apt"
  AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
  AC_SUBST(PACKAGE)
diff --cc debian/changelog
index d1d3c5697,14abe5721..84f68dbf8
--- a/debian/changelog
+++ b/debian/changelog
@@@ -1,5 -1,14 +1,13 @@@
 -apt (0.7.11) UNRELEASED; urgency=low
++apt (0.7.9ubuntu7) hardy; urgency=low
++
++  * methods/connect.cc:
++    - remember hosts with Resolve failures or connect Timeouts
++      see https://wiki.ubuntu.com/NetworklessInstallationFixes
++
++ -- Michael Vogt <michael.vogt@ubuntu.com>  Fri, 08 Feb 2008 11:38:35 +0100
++
 +apt (0.7.9ubuntu6) hardy; urgency=low
  
 -  [ Colin Watson ]
 -  * apt-pkg/algorithms.cc:
 -    - Since APT::Get::List-Cleanup and APT::List-Cleanup both default to
 -      true, the effect of the compatibility code was to require both of them
 -      to be set to false in order to disable list cleanup; this broke the
 -      installer. Instead, disable list cleanup if either of them is set to
 -      false.
 -  
 -  [ Michael Vogt ]
    * cmdline/apt-key:
      - add support for a master-keyring that contains signing keys
        that can be used to sign the archive signing keys. This should
diff --cc methods/connect.cc
index 145001fb3,355bd5c4d..c5d57a99f
--- a/methods/connect.cc
+++ b/methods/connect.cc
@@@ -18,8 -18,10 +18,11 @@@
  #include <stdio.h>
  #include <errno.h>
  #include <unistd.h>
 +#include <sstream>
  
+ #include<set>
+ #include<string>
+ 
  // Internet stuff
  #include <netinet/in.h>
  #include <sys/socket.h>
@@@ -64,6 -69,10 +70,10 @@@ static bool DoConnect(struct addrinfo *
  	       NI_NUMERICHOST|NI_NUMERICSERV);
     Owner->Status(_("Connecting to %s (%s)"),Host.c_str(),Name);
  
+    // if that addr did timeout before, we do not try it again
 -   if(bad_addr.find(string(Name)) != bad_addr.end()) 
++   if(bad_addr.find(string(Name)) != bad_addr.end())
+       return false;
+ 
     /* If this is an IP rotation store the IP we are using.. If something goes
        wrong this will get tacked onto the end of the error message */
     if (LastHostAddr->ai_next != 0)
@@@ -88,7 -99,8 +98,8 @@@
     /* This implements a timeout for connect by opening the connection
        nonblocking */
     if (WaitFd(Fd,true,TimeOut) == false) {
+       bad_addr.insert(bad_addr.begin(), string(Name));
 -      Owner->SetFailExtraMsg("\nFailReason: Timeout");
 +      Owner->SetFailReason("Timeout");
        return _error->Error(_("Could not connect to %s:%s (%s), "
  			   "connection timed out"),Host.c_str(),Service,Name);
     }
@@@ -163,7 -179,8 +178,8 @@@ bool Connect(string Host,int Port,cons
  		  DefPort = 0;
  		  continue;
  	       }
+ 	       bad_addr.insert(bad_addr.begin(), Host);
 -	       Owner->SetFailExtraMsg("\nFailReason: ResolveFailure");
 +	       Owner->SetFailReason("ResolveFailure");
  	       return _error->Error(_("Could not resolve '%s'"),Host.c_str());
  	    }