diff --git a/src/mio/filecache.py b/src/mio/filecache.py index b5bfd4bc9944c3437ef18d73e6f38cd1dc0f07d4..a9c55b22f45211764a46915e1594b253ed3244f5 100755 --- a/src/mio/filecache.py +++ b/src/mio/filecache.py @@ -76,10 +76,26 @@ class Unalias: byaddr.add(sa[0]) pass self.by_name[host] = set() - for name,_,_ in map(socket.gethostbyaddr, byaddr): - self.by_name[host].add(str(name)) + for addr in byaddr: + # Temporary fix for totally broken design + # we should not rely on reverse lookups since that + # mostly fails for local addresses, we should implemennt + # handling of mirrorlists/metalinks + try: + name,_,_ = socket.gethostbyaddr(addr) + self.by_name[host].add(str(name)) + pass + except: + pass pass pass + if not self.by_name[host]: + # Temporary fix for totally broken design + # we should not rely on reverse lookups since that + # mostly fails for local addresses, we should implemennt + # handling of mirrorlists/metalinks + self.by_name[host].add(host) + pass return sorted(self.by_name[host]) def __call__(self, url): @@ -161,7 +177,7 @@ class FileCache: return f def loadfile(self, path, *name, mode=None): - if not path in self.loader: + if not path in self.loader: # Create loader for new path up = urlparse(path) url = urlunparse((up.scheme, up.netloc,'','','',''))