Commit 2a65dc4f authored by Colomban Wendling's avatar Colomban Wendling
Browse files

Properly make the mail thread a daemon thread and properly quit it

A stupid typo lead for the mail thread not to be a daemon thread, thus
preventing Python from quitting before that thread quits by itself.

So properly make it a daemon thread, and as it would now actually get
interrupted abruptly, register an atexit handler to cleanly quit it.
parent 3c87d5ae
......@@ -8,6 +8,7 @@ from time import strftime
import email.charset
from threading import Thread
import queue
import atexit
# Switch to quoted-printable so that we don't get something completely
# unreadable for non-ASCII chars if we have to look at raw email
......@@ -21,8 +22,10 @@ class ThreadedSMTP(object):
self._queue = queue.Queue()
self._loop = True
self._thread = Thread(target=self.__loop)
self._thread.deamon = True
self._thread.daemon = True
# properly clean up on quit
def quit(self):
if self._loop:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment