(self, *args)
deals with an update from Tor; see parsing logic in torcontroller
deals with an update from Tor; see parsing logic in torcontroller
deals with an update from Tor ; see parsing logic in torcontroller
def update(self, *args):
        """
        deals with an update from Tor; see parsing logic in torcontroller
        """

        gmtexpires = None
        (name, ip, expires) = args[:3]

        for arg in args:
            if arg.lower().startswith('expires='):
                gmtexpires = arg[8:]

        if gmtexpires is None:
            if len(args) == 3:
                gmtexpires = expires
            else:
                if args[2] == 'NEVER':
                    gmtexpires = args[2]
                else:
                    gmtexpires = args[3]

        self.name = name                # "www.example.com"
        self.ip = maybe_ip_addr(ip)     # IPV4Address instance, or string

        if self.ip == '<error>':
            self._expire()
            return

        fmt = "%Y-%m-%d %H:%M:%S"

        # if we already have expiry times, etc then we want to
        # properly delay our timeout

        oldexpires = self.expires

        if gmtexpires.upper() == 'NEVER':
            # FIXME can I just select a date 100 years in the future instead?
            self.expires = None
        else:
            self.expires = datetime.datetime.strptime(gmtexpires, fmt)
        self.created = datetime.datetime.utcnow()

        if self.expires is not None:
            if oldexpires is None:
                if self.expires <= self.created:
                    diff = datetime.timedelta(seconds=0)
                else:
                    diff = self.expires - self.created
                self.expiry = self.map.scheduler.callLater(diff.seconds,
                                                           self._expire)

            else:
                diff = self.expires - oldexpires
                self.expiry.delay(diff.seconds)
def update ( self , * args ) : gmtexpires = None ( name , ip , expires ) = args [ : 3 ] for arg in args : if arg . lower ( ) . startswith ( 'expires=' ) : gmtexpires = arg [ 8 : ] if gmtexpires is None : if len ( args ) == 3 : gmtexpires = expires else : if args [ 2 ] == 'NEVER' : gmtexpires = args [ 2 ] else : gmtexpires = args [ 3 ] self . name = name # "www.example.com" self . ip = maybe_ip_addr ( ip ) # IPV4Address instance, or string if self . ip == '<error>' : self . _expire ( ) return fmt = "%Y-%m-%d %H:%M:%S" # if we already have expiry times, etc then we want to # properly delay our timeout oldexpires = self . expires if gmtexpires . upper ( ) == 'NEVER' : # FIXME can I just select a date 100 years in the future instead? self . expires = None else : self . expires = datetime . datetime . strptime ( gmtexpires , fmt ) self . created = datetime . datetime . utcnow ( ) if self . expires is not None : if oldexpires is None : if self . expires <= self . created : diff = datetime . timedelta ( seconds = 0 ) else : diff = self . expires - self . created self . expiry = self . map . scheduler . callLater ( diff . seconds , self . _expire ) else : diff = self . expires - oldexpires self . expiry . delay ( diff . seconds )