]> git.mxchange.org Git - quix0rs-apt-p2p.git/commitdiff
Remove some unnecessary calls to log.err and just print the error message instead.
authorCameron Dale <camrdale@gmail.com>
Mon, 21 Apr 2008 21:15:14 +0000 (14:15 -0700)
committerCameron Dale <camrdale@gmail.com>
Mon, 21 Apr 2008 21:15:14 +0000 (14:15 -0700)
apt_p2p/CacheManager.py
apt_p2p/apt_p2p.py
apt_p2p_Khashmir/DHT.py
apt_p2p_Khashmir/actions.py
apt_p2p_Khashmir/khashmir.py
apt_p2p_Khashmir/ktable.py

index 6801e023d6e152e981e1021c3e1ee47e53ca9de9..e6a8408fb37422bb4f112c9fdd9d0d30c195e540 100644 (file)
@@ -307,7 +307,6 @@ class CacheManager:
         hash = HashObject()
         df = hash.hashInThread(file)
         df.addBoth(self._doneHashing, file, walker)
-        df.addErrback(log.err)
     
     def _doneHashing(self, result, file, walker):
         """If successful, add the hashed file to the DB and inform the main program."""
index dfeb3e7b5ef67c05ef9ab3a236acf3e8bd641938..a771227ab23ef97f3b16129cdeb081ae3e26df71 100644 (file)
@@ -190,12 +190,12 @@ class AptP2P(protocol.Factory):
         findDefer.addCallbacks(self.findHash_done, self.findHash_error, 
                                callbackArgs=(req, url, orig_resp, d),
                                errbackArgs=(req, url, orig_resp, d))
-        findDefer.addErrback(log.err)
         return d
     
     def findHash_error(self, failure, req, url, orig_resp, d):
         """Process the error in hash lookup by returning an empty L{HashObject}."""
-        log.err(failure)
+        log.msg('Hash lookup for %s resulted in an error: %s' %
+                (url, failure.getErrorMessage()))
         self.findHash_done(HashObject(), req, url, orig_resp, d)
         
     def findHash_done(self, hash, req, url, orig_resp, d):
@@ -299,7 +299,7 @@ class AptP2P(protocol.Factory):
         """Check the returned response to be sure it is valid."""
         if isinstance(resp, failure.Failure):
             log.msg('Got error trying to get cached file')
-            log.err()
+            log.err(resp)
             # Try the next possible location
             self.getCachedFile(hash, req, url, d, locations)
             return
index d6ff2f1373eef9abe7c20c5c0ae56eaceb02f89e..7c4c7bd5cfd53806dd9eb092cab88912ea496e87 100644 (file)
@@ -451,7 +451,7 @@ class TestSimpleDHT(unittest.TestCase):
 class TestMultiDHT(unittest.TestCase):
     """More complicated 20-node tests for the DHT."""
     
-    timeout = 80
+    timeout = 100
     num = 20
     DHT_DEFAULTS = {'PORT': 9977,
                     'CHECKPOINT_INTERVAL': 300, 'CONCURRENT_REQS': 4,
index fd5e1c1ade8d2122cfe6f6de0bcbae66e027a8c0..0ac96479a9e716c5dd6801c9f9e8014ba9239610 100644 (file)
@@ -198,8 +198,7 @@ class ActionBase:
 
     def actionFailed(self, err, node, expected_results, df):
         """Receive an error from a remote node."""
-        log.msg("action %s failed (%s) %s/%s" % (self.action, self.config['PORT'], node.host, node.port))
-        log.err(err)
+        log.msg("action %s failed on %s/%s: %s" % (self.action, node.host, node.port, err.getErrorMessage()))
         self.caller.table.nodeFailed(node)
         self.outstanding -= 1
         self.outstanding_results -= expected_results
index 7abed574dee3b59d78115a94f76c3bd9a1d24821..15237a2338c141b5a0a6b46992a0fdbddb87bc75 100644 (file)
@@ -200,8 +200,7 @@ class KhashmirBase(protocol.Factory):
             
             def _staleNodeHandler(err, oldnode = old, newnode = node, self = self, start = datetime.now()):
                 """The pinged node never responded, so replace it."""
-                log.msg("ping failed (%s) %s/%s" % (self.config['PORT'], oldnode.host, oldnode.port))
-                log.err(err)
+                log.msg("action ping failed on %s/%s: %s" % (oldnode.host, oldnode.port, err.getErrorMessage()))
                 self.stats.completedAction('ping', start)
                 self.table.replaceStaleNode(oldnode, newnode)
             
@@ -240,8 +239,7 @@ class KhashmirBase(protocol.Factory):
 
         def _defaultPong(err, node=node, self=self, callback=callback, errback=errback, start = datetime.now()):
             """Error occurred, fail node and errback or callback with error."""
-            log.msg("join failed (%s) %s/%s" % (self.config['PORT'], node.host, node.port))
-            log.err(err)
+            log.msg("action join failed on %s/%s: %s" % (node.host, node.port, err.getErrorMessage()))
             self.stats.completedAction('join', start)
             self.table.nodeFailed(node)
             if errback:
index 499c4d852e1e848fb93f30271728e0391a0cf256..f38789803df27d1c3d13351c280546be170595e2 100644 (file)
@@ -239,7 +239,7 @@ class KTable:
         
         # Make sure our table isn't FULL, this is really unlikely
         if len(self.buckets) >= (khash.HASH_LENGTH*8):
-            log.err("Hash Table is FULL!  Increase K!")
+            log.err(RuntimeError("Hash Table is FULL! Increase K!"))
             return
             
         # This bucket is full and contains our node, split the bucket