mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-19 13:07:56 +00:00
Handle double-disconnect, should it happen by mistake.
This commit is contained in:
parent
23fd11be43
commit
bf176144c5
@ -314,10 +314,15 @@ class FakeCanary(object):
|
||||
def getPeer(self):
|
||||
return "<fake>"
|
||||
|
||||
# For use by tests:
|
||||
def disconnected(self):
|
||||
for (f, args, kwargs) in list(self.disconnectors.values()):
|
||||
f(*args, **kwargs)
|
||||
"""Disconnect the canary, to be called by test code.
|
||||
|
||||
Can only happen once.
|
||||
"""
|
||||
if self.disconnectors is not None:
|
||||
for (f, args, kwargs) in list(self.disconnectors.values()):
|
||||
f(*args, **kwargs)
|
||||
self.disconnectors = None
|
||||
|
||||
|
||||
class ShouldFailMixin(object):
|
||||
|
Loading…
Reference in New Issue
Block a user