mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
some cleanup to finalize PR
This commit is contained in:
@@ -607,22 +607,24 @@ class Account(object):
|
|||||||
self.stop_io()
|
self.stop_io()
|
||||||
|
|
||||||
self.log("remove dc_context references")
|
self.log("remove dc_context references")
|
||||||
# the dc_context_unref triggers get_next_event to return ffi.NULL
|
|
||||||
# which in turns makes the event thread finish execution
|
# if _dc_context is unref'ed the event thread should quickly
|
||||||
|
# receive the termination signal. However, some python code might
|
||||||
|
# still hold a reference and so we use a secondary signal
|
||||||
|
# to make sure the even thread terminates if it receives any new
|
||||||
|
# event, indepedently from waiting for the core to send NULL to
|
||||||
|
# get_next_event().
|
||||||
self._event_thread.mark_shutdown()
|
self._event_thread.mark_shutdown()
|
||||||
self._dc_context = None
|
self._dc_context = None
|
||||||
|
|
||||||
# the following wait is left out for now because it can fail if
|
|
||||||
# a) python code holds an extra self._dc_context reference
|
|
||||||
# b) the core does not manage to send a NULL through get_next_event()
|
|
||||||
self.log("wait for event thread to finish")
|
self.log("wait for event thread to finish")
|
||||||
try:
|
try:
|
||||||
self._event_thread.wait(timeout=2)
|
self._event_thread.wait(timeout=2)
|
||||||
except RuntimeError as e:
|
except RuntimeError as e:
|
||||||
self.log("Could not wait for thread: {}".format(e))
|
self.log("Waiting for event thread failed: {}".format(e))
|
||||||
|
|
||||||
if self._event_thread.is_alive():
|
if self._event_thread.is_alive():
|
||||||
self.log("WARN: event thread did not terminate")
|
self.log("WARN: event thread did not terminate yet, ignoring.")
|
||||||
|
|
||||||
self._shutdown_event.set()
|
self._shutdown_event.set()
|
||||||
|
|
||||||
|
|||||||
@@ -1577,8 +1577,6 @@ class TestOnlineAccount:
|
|||||||
|
|
||||||
def test_ephemeral_timer(self, acfactory, lp):
|
def test_ephemeral_timer(self, acfactory, lp):
|
||||||
ac1, ac2 = acfactory.get_two_online_accounts()
|
ac1, ac2 = acfactory.get_two_online_accounts()
|
||||||
ac1.set_config("e2ee_enabled", "0")
|
|
||||||
ac2.set_config("e2ee_enabled", "0")
|
|
||||||
|
|
||||||
lp.sec("ac1: create chat with ac2")
|
lp.sec("ac1: create chat with ac2")
|
||||||
chat1 = ac1.create_chat(ac2)
|
chat1 = ac1.create_chat(ac2)
|
||||||
|
|||||||
Reference in New Issue
Block a user