#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
more_events
Jose M. Guisado 2020-12-01 10:12:50 +01:00 committed by OpenGnSys Support Team
parent a11224d6f5
commit f8e566bf63
1 changed files with 3 additions and 0 deletions

View File

@ -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