Speed up Webserver demo data rate by not sending a full ethernet frame each time, preventing the receiver from using a delayed ACK scheme which slows down the connection. TELNET server cleanup.

pull/1469/head
Dean Camera 15 years ago
parent 8154331da6
commit c6f21fde62

@ -62,31 +62,3 @@ DRESULT disk_write (
return RES_OK; return RES_OK;
} }
#endif /* _READONLY */ #endif /* _READONLY */
/*-----------------------------------------------------------------------*/
/* Miscellaneous Functions */
DRESULT disk_ioctl (
BYTE drv, /* Physical drive nmuber (0..) */
BYTE ctrl, /* Control code */
void *buff /* Buffer to send/receive control data */
)
{
if (ctrl == CTRL_SYNC)
return RES_OK;
else
return RES_PARERR;
}
DWORD get_fattime (void)
{
return ((DWORD)1 << 25) |
((DWORD)1 << 21) |
((DWORD)1 << 16) |
((DWORD)1 << 11) |
((DWORD)1 << 5) |
((DWORD)1 << 0);
}

@ -5,7 +5,7 @@
#ifndef _DISKIO #ifndef _DISKIO
#define _READONLY 0 /* 1: Read-only mode */ #define _READONLY 0 /* 1: Read-only mode */
#define _USE_IOCTL 1 #define _USE_IOCTL 0
#include "integer.h" #include "integer.h"
#include "ff.h" #include "ff.h"

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

@ -31,7 +31,7 @@
/** \file /** \file
* *
* TELNET Webserver Application. When connected to the uIP stack, * TELNET Webserver Application. When connected to the uIP stack,
* this will serve out connection information to the client. * this will serve out raw TELNET to the client on port 23.
*/ */
#define INCLUDE_FROM_TELNETSERVERAPP_C #define INCLUDE_FROM_TELNETSERVERAPP_C
@ -44,9 +44,13 @@ const char PROGMEM WelcomeHeader[] = "******************************************
/** Main TELNET menu, giving the user the list of available commands they may issue */ /** Main TELNET menu, giving the user the list of available commands they may issue */
const char PROGMEM TELNETMenu[] = "\r\n" const char PROGMEM TELNETMenu[] = "\r\n"
" Available Commands:\r\n" " == Available Commands: ==\r\n"
" c) List Active TCP Connections\r\n" " c) List Active TCP Connections\r\n"
"\r\nCommand>"; " =========================\r\n"
"\r\n>";
/** Header to print before the current connections are printed to the client */
const char PROGMEM CurrentConnectionsHeader = "\r\n* Current TCP Connections: *\r\n";
/** Initialization function for the simple HTTP webserver. */ /** Initialization function for the simple HTTP webserver. */
void TELNETServerApp_Init(void) void TELNETServerApp_Init(void)
@ -65,11 +69,13 @@ void TELNETServerApp_Callback(void)
if (uip_connected()) if (uip_connected())
{ {
/* New connection - initialize connection state values */
AppState->TELNETServer.CurrentState = TELNET_STATE_SendHeader; AppState->TELNETServer.CurrentState = TELNET_STATE_SendHeader;
} }
if (uip_acked()) if (uip_acked())
{ {
/* Progress to the next state once the current state's data has been ACKed */
AppState->TELNETServer.CurrentState = AppState->TELNETServer.NextState; AppState->TELNETServer.CurrentState = AppState->TELNETServer.NextState;
} }
@ -124,7 +130,7 @@ static void TELNETServerApp_DisplayTCPConnections(void)
{ {
char* const AppData = (char*)uip_appdata; char* const AppData = (char*)uip_appdata;
strcpy(AppData, "\r\n* Current TCP Connections: *\r\n"); strcpy_P(AppData, CurrentConnectionsHeader);
uint16_t ResponseLen = strlen(AppData); uint16_t ResponseLen = strlen(AppData);
uint8_t ActiveConnCount = 0; uint8_t ActiveConnCount = 0;

@ -691,7 +691,7 @@ typedef union
uint8_t CurrentState; uint8_t CurrentState;
uint8_t NextState; uint8_t NextState;
char FileName[50]; char FileName[MAX_URI_LENGTH];
FIL FileHandle; FIL FileHandle;
bool FileOpen; bool FileOpen;
uint32_t ACKedFilePos; uint32_t ACKedFilePos;

@ -55,7 +55,7 @@
* To use this project, plug the USB AVR into a computer, so that it enumerates as a standard Mass Storage device. Load * To use this project, plug the USB AVR into a computer, so that it enumerates as a standard Mass Storage device. Load
* HTML files onto the disk, so that they can be served out to clients -- the default file to serve should be called * HTML files onto the disk, so that they can be served out to clients -- the default file to serve should be called
* <i>index.htm</i>. Filenames must be in 8.3 format for them to be retrieved correctly by the webserver, and the total * <i>index.htm</i>. Filenames must be in 8.3 format for them to be retrieved correctly by the webserver, and the total
* requested file path must be equal to or less than 50 characters (set in uipopt.h). * requested file path must be equal to or less than the maximum URI length (\see \ref SSec_Options).
* *
* When attached to a RNDIS class device, such as a USB (desktop) modem, the system will enumerate the device, set the * When attached to a RNDIS class device, such as a USB (desktop) modem, the system will enumerate the device, set the
* appropriate parameters needed for connectivity and begin listening for new HTTP connections on port 80 and TELNET * appropriate parameters needed for connectivity and begin listening for new HTTP connections on port 80 and TELNET
@ -98,5 +98,10 @@
* <td>Default routing gateway that the webserver should use when connected to a RNDIS device (when ENABLE_DHCP_CLIENT * <td>Default routing gateway that the webserver should use when connected to a RNDIS device (when ENABLE_DHCP_CLIENT
* is not defined).</td> * is not defined).</td>
* </tr> * </tr>
* <tr>
* <td>MAX_URI_LENGTH</td>
* <td>Makefile CDEFS</td>
* <td>Maximum length of a URI for the Webserver. This is the maximum file path, including subdirectories and seperators.</td>
* </tr>
* </table> * </table>
*/ */

@ -200,8 +200,9 @@ CSTANDARD = -std=gnu99
# Place -D or -U options here for C sources # Place -D or -U options here for C sources
CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS) CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
CDEFS += -DENABLE_DHCP_CLIENT CDEFS += -DENABLE_DHCP_CLIENT
CDEFS += -DMAX_URI_LENGTH=50
CDEFS += -DUIP_CONF_UDP="defined(ENABLE_DHCP_CLIENT)" -DUIP_CONF_TCP=1 -DUIP_CONF_UDP_CONNS=1 -DUIP_CONF_MAX_CONNECTIONS=5 CDEFS += -DUIP_CONF_UDP="defined(ENABLE_DHCP_CLIENT)" -DUIP_CONF_TCP=1 -DUIP_CONF_UDP_CONNS=1 -DUIP_CONF_MAX_CONNECTIONS=3
CDEFS += -DUIP_CONF_MAX_LISTENPORTS=5 -DUIP_URGDATA=0 -DUIP_CONF_BUFFER_SIZE=1514 -DUIP_ARCH_CHKSUM=0 CDEFS += -DUIP_CONF_MAX_LISTENPORTS=5 -DUIP_URGDATA=0 -DUIP_CONF_BUFFER_SIZE=1514 -DUIP_ARCH_CHKSUM=0
CDEFS += -DUIP_CONF_LL_802154=0 -DUIP_CONF_LL_80211=0 -DUIP_CONF_ROUTER=0 -DUIP_CONF_ICMP6=0 CDEFS += -DUIP_CONF_LL_802154=0 -DUIP_CONF_LL_80211=0 -DUIP_CONF_ROUTER=0 -DUIP_CONF_ICMP6=0
CDEFS += -DUIP_ARCH_ADD32=0 -DUIP_CONF_ICMP_DEST_UNREACH=1 -DUIP_NEIGHBOR_CONF_ADDRTYPE=0 CDEFS += -DUIP_ARCH_ADD32=0 -DUIP_CONF_ICMP_DEST_UNREACH=1 -DUIP_NEIGHBOR_CONF_ADDRTYPE=0

Loading…
Cancel
Save