From d065e1998d4ff5cb5b5b79489032989b98936245 Mon Sep 17 00:00:00 2001 From: Alvaro Neira Ayuso Date: Fri, 27 Dec 2019 14:51:05 +0100 Subject: 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. --- src/ogRest.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ogRest.py b/src/ogRest.py index cec6aa8..60a33b0 100644 --- a/src/ogRest.py +++ b/src/ogRest.py @@ -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): -- cgit v1.2.3-18-g5258