@@ -34,8 +34,7 @@ def __init__(self):
34
34
self .refresh = time () + REASSIGN_INTERVAL
35
35
self .lock = RLock ()
36
36
37
- @staticmethod
38
- def poissonTimeout (start = None , average = 0 ):
37
+ def poissonTimeout (self , start = None , average = 0 ):
39
38
if start is None :
40
39
start = time ()
41
40
if average == 0 :
@@ -49,15 +48,15 @@ def addHash(self, hashId, source=None, stream=1):
49
48
self .hashMap [hashId ] = Stem (
50
49
self .getNodeStem (source ),
51
50
stream ,
52
- Dandelion .poissonTimeout ())
51
+ self .poissonTimeout ())
53
52
54
53
def setHashStream (self , hashId , stream = 1 ):
55
54
with self .lock :
56
55
if hashId in self .hashMap :
57
56
self .hashMap [hashId ] = Stem (
58
57
self .hashMap [hashId ].child ,
59
58
stream ,
60
- Dandelion .poissonTimeout ())
59
+ self .poissonTimeout ())
61
60
62
61
def removeHash (self , hashId , reason = "no reason specified" ):
63
62
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):
81
80
for k in (k for k , v in self .nodeMap .iteritems () if v is None ):
82
81
self .nodeMap [k ] = connection
83
82
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 ())
85
84
invQueue .put ((v .stream , k , v .child ))
86
85
87
86
@@ -94,7 +93,7 @@ def maybeRemoveStem(self, connection):
94
93
for k in (k for k , v in self .nodeMap .iteritems () if v == connection ):
95
94
self .nodeMap [k ] = None
96
95
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 ())
98
97
99
98
def pickStem (self , parent = None ):
100
99
try :
0 commit comments