From 08bb85a95254a54cf9182d0f452b29bf904f5100 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Wed, 7 Feb 2018 17:22:26 +0100 Subject: [PATCH] Dandelion staticmethod fix --- src/network/dandelion.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/network/dandelion.py b/src/network/dandelion.py index bee01d73..098a9a22 100644 --- a/src/network/dandelion.py +++ b/src/network/dandelion.py @@ -34,8 +34,7 @@ class Dandelion(): self.refresh = time() + REASSIGN_INTERVAL self.lock = RLock() - @staticmethod - def poissonTimeout(start=None, average=0): + def poissonTimeout(self, start=None, average=0): if start is None: start = time() if average == 0: @@ -49,7 +48,7 @@ class Dandelion(): self.hashMap[hashId] = Stem( self.getNodeStem(source), stream, - Dandelion.poissonTimeout()) + self.poissonTimeout()) def setHashStream(self, hashId, stream=1): with self.lock: @@ -57,7 +56,7 @@ class Dandelion(): self.hashMap[hashId] = Stem( self.hashMap[hashId].child, stream, - Dandelion.poissonTimeout()) + self.poissonTimeout()) def removeHash(self, hashId, reason="no reason specified"): logging.debug("%s entering fluff mode due to %s.", ''.join('%02x'%ord(i) for i in hashId), reason) @@ -81,7 +80,7 @@ class Dandelion(): for k in (k for k, v in self.nodeMap.iteritems() if v is None): self.nodeMap[k] = connection for k, v in {k: v for k, v in self.hashMap.iteritems() if v.child is None}.iteritems(): - self.hashMap[k] = Stem(connection, v.stream, Dandelion.poissionTimeout()) + self.hashMap[k] = Stem(connection, v.stream, self.poissionTimeout()) invQueue.put((v.stream, k, v.child)) @@ -94,7 +93,7 @@ class Dandelion(): for k in (k for k, v in self.nodeMap.iteritems() if v == connection): self.nodeMap[k] = None for k, v in {k: v for k, v in self.hashMap.iteritems() if v.child == connection}.iteritems(): - self.hashMap[k] = Stem(None, v.stream, Dandelion.poissonTimeout()) + self.hashMap[k] = Stem(None, v.stream, self.poissonTimeout()) def pickStem(self, parent=None): try: