Пример #1
0
 def resolve(self, name, timeout = (1, 3, 11, 45)):
     """Return a Deferred that will resolve a hostname.
     """
     if not name:
         # XXX - This is *less than* '::', and will screw up IPv6 servers
         return defer.succeed('0.0.0.0')
     if abstract.isIPAddress(name):
         return defer.succeed(name)
     return self.resolver.getHostByName(name, timeout)
Пример #2
0
 def resolveAddress(self):
     if abstract.isIPAddress(self.addr[0]):
         self._setRealAddress(self.addr[0])
     else:
         d = self.reactor.resolve(self.addr[0])
         d.addCallbacks(self._setRealAddress, self.failIfNotConnected)