示例#1
0
 def krpcReceived(self, krpc, address):
     if isinstance(krpc, Query):
         self.queryReceived(krpc, address)
     else:
         transaction = self._transactions.get(krpc._transaction_id, None)
         if transaction is not None:
             if isinstance(krpc, Response):
                 self.responseReceived(krpc, transaction, address)
             elif isinstance(krpc, Error):
                 self.errorReceived(krpc, transaction, address)
         else:
             log.msg("Received a reply not corresponding to an" +
                     " outstanding query from: %s, reply: %s" % (
                     contact.address_str(address), str(krpc)))
示例#2
0
 def krpcReceived(self, krpc, address):
     if isinstance(krpc, Query):
         self.queryReceived(krpc, address)
     else:
         transaction = self._transactions.get(krpc._transaction_id, None)
         if transaction is not None:
             if isinstance(krpc, Response):
                 self.responseReceived(krpc, transaction, address)
             elif isinstance(krpc, Error):
                 self.errorReceived(krpc, transaction, address)
         else:
             log.msg("Received a reply not corresponding to an" +
                     " outstanding query from: %s, reply: %s" %
                     (contact.address_str(address), str(krpc)))
示例#3
0
 def test_address_str(self):
     address = ("127.0.0.1", 80)
     expected_str = "ip=127.0.0.1 port=80"
     self.assertEquals(expected_str, contact.address_str(address))
示例#4
0
 def test_address_str(self):
     address = ("127.0.0.1", 80)
     expected_str = "ip=127.0.0.1 port=80"
     self.assertEquals(expected_str, contact.address_str(address))