Execute command received using Threads

Now we are blocking the execution when we apply a command sent from the server.
This behavior is unacceptable for our client.
more_events
Alvaro Neira Ayuso 2019-12-27 14:51:05 +01:00 committed by Alvaro Neira Ayuso
parent db7cc0d99e
commit d065e1998d
1 changed files with 5 additions and 1 deletions

View File

@ -86,11 +86,15 @@ class ogRest():
client.send(self.getResponse(ogResponses.OK))
def process_shellrun(self, client, cmd):
# Executing cmd thread
def execcmd(msgqueue):
msgqueue.put(ogOperations.execCMD(cmd))
if cmd == None:
client.send(self.getResponse(ogResponses.BAD_REQUEST))
return
self.msgqueue.put(ogOperations.execCMD(cmd))
threading.Thread(target=execcmd, args=(self.msgqueue,)).start()
client.send(self.getResponse(ogResponses.IN_PROGRESS))
def process_shellout(self, client):