ffi: remove dc_is_io_running()

It is misleading and should never be checked.

dc_stop_io() also stops pending ephemeral message deletion tasks, so it
should be called in any case before releasing context.
This commit is contained in:
Alexander Krotov
2021-01-13 02:33:48 +03:00
committed by link2xt
parent ebccdbbcb9
commit 8412affe37
7 changed files with 5 additions and 47 deletions

View File

@@ -459,8 +459,6 @@ class Account(object):
If sending out was unsuccessful, a RuntimeError is raised.
"""
self.check_is_configured()
if not self.is_started():
raise RuntimeError("IO not running, can not send out")
res = lib.dc_initiate_key_transfer(self._dc_context)
if res == ffi.NULL:
raise RuntimeError("could not send out autocrypt setup message")
@@ -592,9 +590,6 @@ class Account(object):
lib.dc_configure(self._dc_context)
return configtracker
def is_started(self):
return self._event_thread.is_alive() and bool(lib.dc_is_io_running(self._dc_context))
def wait_shutdown(self):
""" wait until shutdown of this account has completed. """
self._shutdown_event.wait()
@@ -604,11 +599,8 @@ class Account(object):
self.log("stop_ongoing")
self.stop_ongoing()
if bool(lib.dc_is_io_running(self._dc_context)):
self.log("dc_stop_io (stop core IO scheduler)")
lib.dc_stop_io(self._dc_context)
else:
self.log("stop_scheduler called on non-running context")
self.log("dc_stop_io (stop core IO scheduler)")
lib.dc_stop_io(self._dc_context)
def shutdown(self):
""" shutdown and destroy account (stop callback thread, close and remove

View File

@@ -361,7 +361,7 @@ def acfactory(pytestconfig, tmpdir, request, session_liveconfig, data):
for acc in self._accounts:
self.wait_configure(acc)
acc.set_config("bcc_self", "0")
if acc.is_configured() and not acc.is_started():
if acc.is_configured() and acc not in started_accounts:
acc.start_io()
started_accounts.append(acc)
print("{}: {} account was successfully setup".format(