Erik - / SW_HTTPServer

Fork of SW_HTTPServer by David Smart

Revision:
9:2ea342765c9d
Parent:
8:262583f054f6
Child:
10:9c8d2c6a3469
--- a/SW_HTTPServer.cpp	Mon Jul 01 04:36:54 2013 +0000
+++ b/SW_HTTPServer.cpp	Thu Jul 04 01:58:13 2013 +0000
@@ -46,6 +46,9 @@
 };
 
 #ifdef DEBUG
+// This uses standard library dynamic memory management, but for an 
+// embedded system there are alternates that may make better sense -
+// search the web for embedded system malloc alternates.
 static void * MyMalloc(int x, int y)
 {
     std::printf("[%04d] malloc(%d)\r\n", y, x);
@@ -157,7 +160,7 @@
 #ifdef DEBUG
     static state lastOp = Reset;
     if (lastOp != op) {
-        char *states[] = {"Idle", "Receiving", "Sending", "WaitingToClose", "Reset"};
+        const char *states[] = {"Idle", "Receiving", "Sending", "WaitingToClose", "Reset"};
         pc->printf("Poll: %s\r\n", states[op]);
         lastOp = op;
     }
@@ -182,7 +185,9 @@
         case Receiving:
             n = client.receive(bPtr, headerbuffersize - (bPtr - headerbuffer));
             if (n < 0) {
+#ifdef DEBUG
                 pc->printf("*** client.receive() => %d\r\n", n);
+#endif
             } else if (n) {
                 bPtr[n] = '\0';
                 if (ParseHeader(headerbuffer)) {
@@ -198,6 +203,7 @@
             op = WaitingToClose;
             RecordPerformanceData(&perfData.SendData, t_ref);
             break;
+
         case WaitingToClose:
             close_connection();
             op = Idle;