summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2020-12-01 10:12:50 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-12-01 13:32:18 +0100
commitf8e566bf63fbc24466e153a713f6474b326a2f1b (patch)
treeffc2f6d1a6fe191bb5ffb2a085fcf785feda34b5
parenta11224d6f587052226b9f94fc942092d6eab5896 (diff)
#1000 ogRest: set idle state after processing bad request
Before this patch the ogRest would hang indifinitely in a BUSY state when a bad request was received. Fix this by returning ogRest state to IDLE once the corresponding bad request response has been sent. This accounts for the following cases: - Unknown GET action - Unknown POST action - Unknown HTTP verb
-rw-r--r--src/ogRest.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ogRest.py b/src/ogRest.py
index c50adfa..d9d6f4a 100644
--- a/src/ogRest.py
+++ b/src/ogRest.py
@@ -300,6 +300,7 @@ class ogRest():
f'{method[:ogRest.LOG_LENGTH]}')
response = restResponse(ogResponses.BAD_REQUEST)
client.send(response.get())
+ self.state = ThreadState.IDLE
elif ("POST" in method):
if ("poweroff" in URI):
self.process_poweroff(client)
@@ -327,9 +328,11 @@ class ogRest():
f'{method[:ogRest.LOG_LENGTH]}')
response = restResponse(ogResponses.BAD_REQUEST)
client.send(response.get())
+ self.state = ThreadState.IDLE
else:
response = restResponse(ogResponses.BAD_REQUEST)
client.send(response.get())
+ self.state = ThreadState.IDLE
return 0