Server hangs inside httpd_resp_send_chunk when client goes away
Posted: Sat Jun 19, 2021 6:53 pm
I'm serving chunked mjpeg from an esp32-cam (thinkertoy). I know my code can't handle more than one client request at a time. But I'd at least like to be able to close a browser window showing the video and then have the server cleanly close the http connection. Then another browser could start viewing the video.
Right now, when the client disappears, the server hangs in a httpd_resp_send_chunk call and never returns. So there is no way inside the handler to close the stream with p_send_chunk(req, NULL, 0);
I tried saving the req pointer globally and then doing the p_send_chunk(req, NULL, 0); from an outside loop timeout but that crashed the esp32 (not a big surprise).
Any ideas?
Right now, when the client disappears, the server hangs in a httpd_resp_send_chunk call and never returns. So there is no way inside the handler to close the stream with p_send_chunk(req, NULL, 0);
I tried saving the req pointer globally and then doing the p_send_chunk(req, NULL, 0); from an outside loop timeout but that crashed the esp32 (not a big surprise).
Any ideas?