Ejemplo n.º 1
0
    def router_from_id(self, routerid):
        """IRouterContainer API"""

        try:
            return self.routers[routerid]

        except KeyError:
            router = Router(self.protocol)
            if routerid[0] != '$':
                raise                   # just re-raise the KeyError

            idhash = routerid[1:41]
            nick = ''
            is_named = False
            if len(routerid) > 41:
                nick = routerid[42:]
                is_named = routerid[41] is '='
            router.update(nick, hashFromHexId(idhash), '0'*27, 'unknown', 'unknown', '0', '0')
            router.name_is_unique = is_named
            return router
Ejemplo n.º 2
0
    def router_from_id(self, routerid):
        """IRouterContainer API"""

        try:
            return self.routers[routerid]

        except KeyError:
            router = Router(self.protocol)
            if routerid[0] != '$':
                raise  # just re-raise the KeyError

            idhash = routerid[1:41]
            nick = ''
            is_named = False
            if len(routerid) > 41:
                nick = routerid[42:]
                is_named = routerid[41] == '='
            router.update(nick, hashFromHexId(idhash), '0' * 27, 'unknown',
                          'unknown', '0', '0')
            router.name_is_unique = is_named
            return router
Ejemplo n.º 3
0
    def router_from_id(self, routerid):
        """IRouterContainer API"""

        try:
            return self.routers[routerid[:41]]

        except KeyError:
            if routerid[0] != "$":
                raise  # just re-raise the KeyError

            router = Router(self.protocol)
            idhash = routerid[1:41]
            nick = ""
            is_named = False
            if len(routerid) > 41:
                nick = routerid[42:]
                is_named = routerid[41] == "="
            router.update(nick, hashFromHexId(idhash), "0" * 27, "unknown", "unknown", "0", "0")
            router.name_is_unique = is_named
            self.routers[router.id_hex] = router
            return router