From f466ebd3f1647cee29c51adbb05f1aa6c026d02b Mon Sep 17 00:00:00 2001 From: Ruakij Date: Mon, 2 Aug 2021 12:00:13 +0200 Subject: [PATCH] Added multithreading --- daemon.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/daemon.py b/daemon.py index ad5cc15..2d1a9ab 100755 --- a/daemon.py +++ b/daemon.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 -import os, subprocess, socket, datetime, getopt, sys, re, atexit, yaml, logging as log +import os, _thread, subprocess, socket, datetime, getopt, sys, re, atexit, yaml, logging as log from pathlib import Path import dns.flags @@ -37,9 +37,7 @@ def startListen(s): log.debug(f'Now listening') while True: (address, dmsg) = receiveFromWire(s) - - if handleQuery(s, address, dmsg) != True: - continue + _thread.start_new_thread(handleQuery, (s, address, dmsg)) def receiveFromWire(s): (wire, address) = s.recvfrom(512)