HttpServer Library for "mbed-os" which added a snapshot handler.

Dependents:   GR-PEACH-webcam GR-Boards_WebCamera GR-Boards_WebCamera GR-Boards_WebCamera

Fork of HttpServer_snapshot by Renesas

Revision:
8:a9fb8fe9b8a3
Parent:
5:b8f6a11c70db
Child:
11:0700755d64ae
--- a/Handler/FSHandler.cpp	Wed Oct 21 08:27:27 2015 +0000
+++ b/Handler/FSHandler.cpp	Fri Oct 23 11:02:35 2015 +0000
@@ -25,6 +25,9 @@
 
 #define DEFAULT_PAGE "/index.htm"
 
+Semaphore FSHandler::req_sem(1);
+
+
 //*FSHandler::FSHandler(const char* rootPath, const char* path, TCPSocket* pTCPSocket) : HTTPRequestHandler(rootPath, path, pTCPSocket), m_err404(false)
 FSHandler::FSHandler(const char* rootPath, const char* path, TCPSocketConnection* pTCPSocketConnection) : HTTPRequestHandler(rootPath, path, pTCPSocketConnection), m_err404(false)
 {}
@@ -59,6 +62,7 @@
 
 void FSHandler::doGet()
 {
+    req_sem.wait();
 #ifdef _DEBUG_FS_HANDLER
     printf("\r\nIn FSHandler::doGet() - rootPath=%s, path=%s\r\n", rootPath().c_str(), path().c_str());
 #endif
@@ -86,6 +90,7 @@
         respHeaders()["Connection"] = "close";
         writeData(msg,strlen(msg)); //Only send header
         printf("\r\nExit FSHandler::doGet() w Error 404\r\n");
+        req_sem.release();
         return;
     }
 
@@ -99,6 +104,7 @@
 #ifdef _DEBUG_FS_HANDLER
     printf("\r\nExit SimpleHandler::doGet()\r\n");
 #endif
+    req_sem.release();
 }
 
 void FSHandler::doPost()