jczic / MicroWebSrv

A micro HTTP Web server that supports WebSockets, html/python language templating and routing handlers, for MicroPython (used on Pycom modules & ESP32)
https://github.com/jczic/MicroWebSrv
MIT License
640 stars 115 forks source link

MicroWebSrv.Start never terminates when threaded=False and Stop() is called #75

Open serious-scribbler opened 3 years ago

serious-scribbler commented 3 years ago

When Stop is called from a route handler in un-threaded mode, Start() never terminates. An important thing to note is that I'm running the module on ESP8266 (precompiled using the cross compiler) and removed the import of _thread and replaced the content of _startThread() with return True, since it isn't needed and was using _thread.

I fixed this in my own copy by changing the following line of _serverProcess() from while True: to while self._started: and adding self._started = False to Stop().

jczic commented 1 year ago

👍🏻 @serious-scribbler