예제 #1
0
    def rpc_ping(self, src_hostport, dest_hostport):
        """
        Ping!
        """
        log.debug("atlas network: ping(%s,%s)" % (src_hostport, dest_hostport))
        self.possibly_drop(src_hostport, dest_hostport)

        dest_host, dest_port = url_to_host_port(dest_hostport)
        rpc = BlockstackRPCClient(dest_host, dest_port)
        return rpc.ping('atlas_network', src_hostport, dest_hostport)
예제 #2
0
    def rpc_put_zonefiles(self, src_hostport, dest_hostport, zonefile_info):
        """
        Upload a list of zonefiles, and enqueue them in the pusher
        """
        log.debug("atlas network: put_zonefiles(%s,%s)" %
                  (src_hostport, dest_hostport))
        self.possibly_drop(src_hostport, dest_hostport)

        dest_host, dest_port = url_to_host_port(dest_hostport)
        rpc = BlockstackRPCClient(dest_host, dest_port, src=src_hostport)
        return rpc.put_zonefiles('atlas_network', src_hostport, dest_hostport,
                                 zonefile_info)
예제 #3
0
    def rpc_get_atlas_peers(self, src_hostport, dest_hostport):
        """
        Get the list of peers in this peer's neighbor set, with simulated loss.
        """
        log.debug("atlas network: get_atlas_peers(%s,%s)" %
                  (src_hostport, dest_hostport))
        self.possibly_drop(src_hostport, dest_hostport)

        dest_host, dest_port = url_to_host_port(dest_hostport)
        rpc = BlockstackRPCClient(dest_host, dest_port, src=src_hostport)
        return rpc.get_atlas_peers('atlas_network', src_hostport,
                                   dest_hostport)
예제 #4
0
    def rpc_get_zonefiles(self, src_hostport, dest_hostport, zonefile_hashes):
        """
        Get the list of zonefiles, given the zonefile hashes (with simulated loss)
        Returns [{'zonefile hash': zonefile data}]
        """
        log.debug("atlas network: get_zonefiles(%s,%s)" %
                  (src_hostport, dest_hostport))
        self.possibly_drop(src_hostport, dest_hostport)

        dest_host, dest_port = url_to_host_port(dest_hostport)
        rpc = BlockstackRPCClient(dest_host, dest_port, src=src_hostport)
        return rpc.get_zonefiles('atlas_network', src_hostport, dest_hostport,
                                 zonefile_hashes)
예제 #5
0
    def rpc_get_zonefile_inventory(self, src_hostport, dest_hostport,
                                   bit_offset, bit_len, **con_info):
        """
        Get zonefile inventory from the given dest hostport, with simulated loss
        """
        log.debug("atlas network: get_zonefile_inventory(%s,%s)" %
                  (src_hostport, dest_hostport))
        self.possibly_drop(src_hostport, dest_hostport)
        time.sleep(self.inv_delay(dest_hostport))

        dest_host, dest_port = url_to_host_port(dest_hostport)
        rpc = BlockstackRPCClient(dest_host, dest_port, src=src_hostport)
        return rpc.get_zonefile_inventory('atlas_network', src_hostport,
                                          dest_hostport, bit_offset, bit_len)
예제 #6
0
    def rpc_getinfo(self, src_hostport, dest_hostport):
        """
        get info
        """
        log.debug("atlas network: getinfo(%s,%s)" %
                  (src_hostport, dest_hostport))
        self.possibly_drop(src_hostport, dest_hostport)

        dest_host, dest_port = url_to_host_port(dest_hostport)
        rpc = BlockstackRPCClient(dest_host, dest_port)
        try:
            return rpc.getinfo('atlas_network', src_hostport, dest_hostport)
        except Exception, e:
            log.exception(e)
            return {'error': 'exception caught'}