Skip to content

Commit 08bb85a

Browse files
committed
Dandelion staticmethod fix
1 parent c683409 commit 08bb85a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/network/dandelion.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ def __init__(self):
3434
self.refresh = time() + REASSIGN_INTERVAL
3535
self.lock = RLock()
3636

37-
@staticmethod
38-
def poissonTimeout(start=None, average=0):
37+
def poissonTimeout(self, start=None, average=0):
3938
if start is None:
4039
start = time()
4140
if average == 0:
@@ -49,15 +48,15 @@ def addHash(self, hashId, source=None, stream=1):
4948
self.hashMap[hashId] = Stem(
5049
self.getNodeStem(source),
5150
stream,
52-
Dandelion.poissonTimeout())
51+
self.poissonTimeout())
5352

5453
def setHashStream(self, hashId, stream=1):
5554
with self.lock:
5655
if hashId in self.hashMap:
5756
self.hashMap[hashId] = Stem(
5857
self.hashMap[hashId].child,
5958
stream,
60-
Dandelion.poissonTimeout())
59+
self.poissonTimeout())
6160

6261
def removeHash(self, hashId, reason="no reason specified"):
6362
logging.debug("%s entering fluff mode due to %s.", ''.join('%02x'%ord(i) for i in hashId), reason)
@@ -81,7 +80,7 @@ def maybeAddStem(self, connection):
8180
for k in (k for k, v in self.nodeMap.iteritems() if v is None):
8281
self.nodeMap[k] = connection
8382
for k, v in {k: v for k, v in self.hashMap.iteritems() if v.child is None}.iteritems():
84-
self.hashMap[k] = Stem(connection, v.stream, Dandelion.poissionTimeout())
83+
self.hashMap[k] = Stem(connection, v.stream, self.poissionTimeout())
8584
invQueue.put((v.stream, k, v.child))
8685

8786

@@ -94,7 +93,7 @@ def maybeRemoveStem(self, connection):
9493
for k in (k for k, v in self.nodeMap.iteritems() if v == connection):
9594
self.nodeMap[k] = None
9695
for k, v in {k: v for k, v in self.hashMap.iteritems() if v.child == connection}.iteritems():
97-
self.hashMap[k] = Stem(None, v.stream, Dandelion.poissonTimeout())
96+
self.hashMap[k] = Stem(None, v.stream, self.poissonTimeout())
9897

9998
def pickStem(self, parent=None):
10099
try:

0 commit comments

Comments
 (0)