1
0

Allow syncronizer to be GC-ed

Proper fix for #1525.
Using python's GC module, I've verified that the daemon, when running,
now releases all verifiers, synchronizers and wallets - all the resources
we care about releasing.
This commit is contained in:
Neil Booth
2015-11-12 08:40:58 +09:00
parent d612684196
commit 8cc3b58364
3 changed files with 14 additions and 1 deletions

View File

@@ -556,6 +556,13 @@ class Network(util.DaemonThread):
message_id = self.queue_request(method, params)
self.unanswered_requests[message_id] = method, params, callback
def unsubscribe(self, callback):
'''Unsubscribe a callback to free object references to enable GC.'''
# Note: we can't unsubscribe from the server, so if we receive
# subsequent notifications process_response() will emit a harmless
# "received unexpected notification" warning
self.subscriptions.pop(callback, None)
def connection_down(self, server):
'''A connection to server either went down, or was never made.
We distinguish by whether it is in self.interfaces.'''