Selaa lähdekoodia

Close HTTP session when live stream terminates

SybexXx 1 päivä sitten
vanhempi
sitoutus
863fbaab39
1 muutettua tiedostoa jossa 5 lisäystä ja 2 poistoa
  1. 5 2
      code/components/jomjol_flowcontroll/MainFlowControl.cpp

+ 5 - 2
code/components/jomjol_flowcontroll/MainFlowControl.cpp

@@ -350,13 +350,16 @@ esp_err_t handler_stream(httpd_req_t *req)
         }
     }
 
-    Camera.CaptureToStream(req, flashlightOn);
+    // Closing the browser popup makes the next stream send fail. Propagate
+    // that error so esp_http_server closes the client session instead of
+    // treating the interrupted stream as a reusable successful connection.
+    const esp_err_t streamResult = Camera.CaptureToStream(req, flashlightOn);
 
 #ifdef DEBUG_DETAIL_ON
     LogFile.WriteHeapInfo("handler_stream - Done");
 #endif
 
-    return ESP_OK;
+    return streamResult;
 }
 
 esp_err_t handler_flow_start(httpd_req_t *req)