Added multithreading
This commit is contained in:
parent
10412ac5a4
commit
f466ebd3f1
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/python3
|
#!/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
|
from pathlib import Path
|
||||||
|
|
||||||
import dns.flags
|
import dns.flags
|
||||||
@ -37,9 +37,7 @@ def startListen(s):
|
|||||||
log.debug(f'Now listening')
|
log.debug(f'Now listening')
|
||||||
while True:
|
while True:
|
||||||
(address, dmsg) = receiveFromWire(s)
|
(address, dmsg) = receiveFromWire(s)
|
||||||
|
_thread.start_new_thread(handleQuery, (s, address, dmsg))
|
||||||
if handleQuery(s, address, dmsg) != True:
|
|
||||||
continue
|
|
||||||
|
|
||||||
def receiveFromWire(s):
|
def receiveFromWire(s):
|
||||||
(wire, address) = s.recvfrom(512)
|
(wire, address) = s.recvfrom(512)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user