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:
5:b8f6a11c70db
Parent:
4:1b6b021ee21d
Child:
8:a9fb8fe9b8a3
--- a/Handler/FSHandler.cpp	Fri Feb 21 07:10:30 2014 +0000
+++ b/Handler/FSHandler.cpp	Sat Feb 22 05:51:59 2014 +0000
@@ -17,15 +17,10 @@
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 */
-#ifdef _DEBUG_ALL
-#define _DEBUG_FS_HANDLER
-#endif
+//#define _DEBUG_FS_HANDLER
 
 #include "FSHandler.h"
 
-//#define __DEBUG
-//#include "dbg/dbg.h"
-
 #define CHUNK_SIZE 128
 
 #define DEFAULT_PAGE "/index.htm"
@@ -36,9 +31,20 @@
 
 FSHandler::~FSHandler()
 {
-    if(m_fp)
+#ifdef _DEBUG_FS_HANDLER
+    printf("\r\n+++FSHandler destroy\r\n");
+#endif
+    if(m_fp){
+#ifdef _DEBUG_FS_HANDLER
+    printf("\r\n+++FSHandler fclose start\r\n");
+#endif
         fclose(m_fp);
 #ifdef _DEBUG_FS_HANDLER
+    printf("\r\n+++FSHandler fclose end\r\n");
+#endif
+       
+        }
+#ifdef _DEBUG_FS_HANDLER
     printf("\r\nHandler destroyed\r\n");
 #endif
 }
@@ -130,16 +136,18 @@
 #ifdef _DEBUG_FS_HANDLER
                 printf("FSHandler: Socket error %d\n", writtenLen);
 #endif
-/**  Not Work
-                if(writtenLen == TCPSOCKET_MEM) {
-                    fseek(m_fp, -len, SEEK_CUR);
-                    return; //Wait for the queued TCP segments to be transmitted
-                } else {
-                    //This is a critical error
-                    close();
-                    return;
-                }
-**/
+                /**  Not Work
+                                if(writtenLen == TCPSOCKET_MEM) {
+                                    fseek(m_fp, -len, SEEK_CUR);
+                                    return; //Wait for the queued TCP segments to be transmitted
+                                } else {
+                                    //This is a critical error
+                                    **/
+                                    close();
+                                    return;
+                                    /**
+                                }
+                **/
             } else if(writtenLen < len) { //Short write, socket's buffer is full
                 fseek(m_fp, writtenLen - len, SEEK_CUR);
                 return;
@@ -153,6 +161,21 @@
 
 void FSHandler::onClose() //Connection is closing
 {
-    if(m_fp)
-        fclose(m_fp);
+    /**
+#ifdef _DEBUG_FS_HANDLER
+        printf("FSHandler: onClose start \r\n");
+#endif
+    if(m_fp){
+#ifdef _DEBUG_FS_HANDLER
+        printf("FSHandler: fclose start \r\n");
+#endif
+    fclose(m_fp);
+#ifdef _DEBUG_FS_HANDLER
+    printf("FSHandler: fclose end \r\n");
+#endif
 }
+#ifdef _DEBUG_FS_HANDLER
+        printf("FSHandler: onClose end \r\n");
+#endif
+**/
+}