Speed up Webserver demo data rate by not sending a full ethernet frame each time...
[pub/USBasp.git] / Projects / Webserver / Lib / HTTPServerApp.c
index e781beb..0d0cbb9 100644 (file)
@@ -31,7 +31,7 @@
 /** \file\r
  *\r
  *  Simple HTTP Webserver Application. When connected to the uIP stack,\r
- *  this will serve out files to HTTP clients.\r
+ *  this will serve out files to HTTP clients on port 80.\r
  */\r
  \r
 #define  INCLUDE_FROM_HTTPSERVERAPP_C\r
@@ -270,8 +270,12 @@ static void HTTPServerApp_SendData(void)
        uip_tcp_appstate_t* const AppState    = &uip_conn->appstate;\r
        char*               const AppData     = (char*)uip_appdata;\r
 \r
-       /* Must determine the maximum segment size to determine maximum file chunk size */\r
-       uint16_t MaxSegmentSize = uip_mss();\r
+       /* Must determine the maximum segment size to determine maximum file chunk size - never send a completely\r
+        * full packet, as this will cause some hosts to start delaying ACKs until a non-full packet is received.\r
+        * since uIP only allows one packet to be in transit at a time, this would cause long delays between packets\r
+        * until the host times out and sends the ACK for the last received packet.\r
+        */\r
+       uint16_t MaxSegmentSize = (uip_mss() >> 1);\r
 \r
        /* Return file pointer to the last ACKed position */\r
        f_lseek(&AppState->HTTPServer.FileHandle, AppState->HTTPServer.ACKedFilePos);\r