Example #1
0
    def testOwnIPCanBeNone(self):
        self._client = HAP_WSClient("http://localhost:8080/sis/HAPEndpoint",
                                    None, 5588)
        n1 = HAPNeighbourStatisticsDTO(1024, "192.168.0.75", 1024)
        n2 = HAPNeighbourStatisticsDTO(2048, "192.168.0.83", 2048)

        nstats = [n1, n2]

        self._client.report_activity(nstats)
        self._client = None
 def __init__(self, client_config):
     # neighbours is a multidimensional dictionary, where the first dimension's key
     # is the download for which upload/download statistics are gathered, and the second
     # dimension is the peer identifier. it stores and updates total upload and download
     # for traffic for active and non-active neighbours
     # example: neighbours[{torrend_id}][{peer_id}]['upload']
     # peer_id is comprised of ip address and port!
     self._neighbours = {}
     self._neighbour_ips = []
     self._client_config = client_config
     self._hap_client = HAP_WSClient(client_config.get_sis_hap_url(), None,
                                     client_config.get_port())
     self._last_report_sent = time.time() - client_config.get_hap_interval()
     self._logger = logging.getLogger("Status.HAP")
     self._last_period_peer_total = {}