Преглед изворни кода

Close HTTP session when live stream terminates

SybexXx пре 1 дан
родитељ
комит
863fbaab39
1 измењених фајлова са 5 додато и 2 уклоњено
  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
 #ifdef DEBUG_DETAIL_ON
     LogFile.WriteHeapInfo("handler_stream - Done");
     LogFile.WriteHeapInfo("handler_stream - Done");
 #endif
 #endif
 
 
-    return ESP_OK;
+    return streamResult;
 }
 }
 
 
 esp_err_t handler_flow_start(httpd_req_t *req)
 esp_err_t handler_flow_start(httpd_req_t *req)