aboutsummaryrefslogtreecommitdiff
path: root/ayatanawebmail
diff options
context:
space:
mode:
authorIngo Meyer <IJ_M@gmx.de>2022-03-01 13:32:43 +0100
committerIngo Meyer <IJ_M@gmx.de>2022-03-01 13:32:43 +0100
commitaeb27d70ecd4e2728337cca66d39f93a48e6ca20 (patch)
treeabd348e80aa778c675dccb3a99f80204bf77affb /ayatanawebmail
parentf19ae5504847aae3336a4f352fd39d5d134f7199 (diff)
downloadayatana-webmail-aeb27d70ecd4e2728337cca66d39f93a48e6ca20.tar.gz
ayatana-webmail-aeb27d70ecd4e2728337cca66d39f93a48e6ca20.tar.bz2
ayatana-webmail-aeb27d70ecd4e2728337cca66d39f93a48e6ca20.zip
Fix blocked idler on calling the `stop` method
Calling the idler `stop` method sends a signal to the internally used thread to finish its work. However, this thread is already blocked by the IMAP IDLE mode and only released after reaching the IDLE timeout. Thus, this commit sends another IMAP command (a simple NOOP) to abort the IDLE mode so the thread can be released without any delay. This commit fixes GitHub issue #26.
Diffstat (limited to 'ayatanawebmail')
-rwxr-xr-xayatanawebmail/idler.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/ayatanawebmail/idler.py b/ayatanawebmail/idler.py
index 8f956ea..3e852a1 100755
--- a/ayatanawebmail/idler.py
+++ b/ayatanawebmail/idler.py
@@ -22,6 +22,9 @@ class Idler(object):
def stop(self):
+ if self.oConnection.oImap is not None:
+ # Send a NOOP command to interrupt the IDLE mode and free the blocked thread
+ self.oConnection.oImap.noop()
self.oEvent.set()
def join(self):