]> git.mxchange.org Git - quix0rs-apt-p2p.git/blobdiff - apt_p2p_Khashmir/knode.py
New TODO for better total number of nodes calculation.
[quix0rs-apt-p2p.git] / apt_p2p_Khashmir / knode.py
index 1fbdbc3302521f62efa406dc2daabd52fb7e8a3f..82eb988311b8519fdf2c49d6c29e5c0a99eead72 100644 (file)
@@ -1,5 +1,3 @@
-## Copyright 2002-2004 Andrew Loewenstern, All Rights Reserved
-# see LICENSE.txt for license information
 
 """Represents a khashmir node in the DHT."""
 
@@ -7,21 +5,24 @@ from twisted.python import log
 
 from node import Node, NULL_ID
 
+class KNodeError(Exception):
+    """An error occurred in contacting the node."""
+
 class KNodeBase(Node):
     """A basic node that can only be pinged and help find other nodes."""
     
     def checkSender(self, dict):
         """Check the sender's info to make sure it meets expectations."""
         try:
-            senderid = dict['rsp']['id']
+            senderid = dict['id']
         except KeyError:
             log.msg("No peer id in response")
-            raise Exception, "No peer id in response."
+            raise KNodeError, "No peer id in response."
         else:
             if self.id != NULL_ID and senderid != self.id:
                 log.msg("Got response from different node than expected.")
                 self.table.invalidateNode(self)
-                raise Exception, "Node ID has changed"
+                raise KNodeError, "Node ID has changed"
                 
         return dict