move getting private_key/our_actor to __init__ (for main thread)

This commit is contained in:
jesopo 2019-09-16 15:49:03 +01:00
parent a48aececfd
commit 6959bba5f3

View file

@ -12,12 +12,6 @@ class Server(object):
self.username = username self.username = username
self.instance = instance self.instance = instance
self._request_queue = queue.Queue()
self._request_thread = threading.Thread(target=self._request_loop)
self._request_thread.daemon = True
self._request_thread.start()
def _request_loop(self):
url_for = self.exports.get_one("url-for") url_for = self.exports.get_one("url-for")
key_id = self._ap_keyid_url(url_for) key_id = self._ap_keyid_url(url_for)
@ -28,6 +22,14 @@ class Server(object):
del url_for del url_for
self._request_queue = queue.Queue()
self._request_thread = threading.Thread(target=self._request_loop,
args=(private_key, our_actor))
self._request_thread.daemon = True
self._request_thread.start()
def _request_loop(self, private_key, our_actor):
while True: while True:
obj = self._request_queue.get() obj = self._request_queue.get()
if obj == "kill": if obj == "kill":