projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Be doubly-certain that the incomming CDC class driver's endpoint/pipe is flushed...
[pub/USBasp.git]
/
Projects
/
Webserver
/
Lib
/
WebserverApp.c
diff --git
a/Projects/Webserver/Lib/WebserverApp.c
b/Projects/Webserver/Lib/WebserverApp.c
index
cba3b43
..
02f38be
100644
(file)
--- a/
Projects/Webserver/Lib/WebserverApp.c
+++ b/
Projects/Webserver/Lib/WebserverApp.c
@@
-76,7
+76,7
@@
char PROGMEM HTTPPage[] =
void WebserverApp_Init(void)
\r
{
\r
/* Listen on port 80 for HTTP connections from hosts */
\r
void WebserverApp_Init(void)
\r
{
\r
/* Listen on port 80 for HTTP connections from hosts */
\r
- uip_listen(HTONS(
80
));
\r
+ uip_listen(HTONS(
HTTP_SERVER_PORT
));
\r
}
\r
\r
/** uIP stack application callback for the simple HTTP webserver. This function must be called each time the
\r
}
\r
\r
/** uIP stack application callback for the simple HTTP webserver. This function must be called each time the
\r
@@
-84,8
+84,9
@@
void WebserverApp_Init(void)
*/
\r
void WebserverApp_Callback(void)
\r
{
\r
*/
\r
void WebserverApp_Callback(void)
\r
{
\r
- char* AppDataPtr = (char*)uip_appdata;
\r
- uint16_t AppDataSize = 0;
\r
+ uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
\r
+ char* AppData = (char*)uip_appdata;
\r
+ uint16_t AppDataSize = 0;
\r
\r
if (uip_closed() || uip_aborted() || uip_timedout())
\r
{
\r
\r
if (uip_closed() || uip_aborted() || uip_timedout())
\r
{
\r
@@
-95,12
+96,12
@@
void WebserverApp_Callback(void)
else if (uip_connected())
\r
{
\r
/* New connection - initialize connection state and data pointer to the appropriate HTTP header */
\r
else if (uip_connected())
\r
{
\r
/* New connection - initialize connection state and data pointer to the appropriate HTTP header */
\r
-
uip_conn->appstate.
SendPos = HTTP200Header;
\r
-
uip_conn->appstate.
CurrentState = WEBSERVER_STATE_SendHeaders;
\r
+
AppState->
SendPos = HTTP200Header;
\r
+
AppState->
CurrentState = WEBSERVER_STATE_SendHeaders;
\r
}
\r
\r
/* Calculate the maximum segment size and remaining data size */
\r
}
\r
\r
/* Calculate the maximum segment size and remaining data size */
\r
- uint16_t BytesRemaining = strlen_P(
uip_conn->appstate.
SendPos);
\r
+ uint16_t BytesRemaining = strlen_P(
AppState->
SendPos);
\r
uint16_t MaxSegSize = uip_mss();
\r
\r
/* No more bytes remaining in the current data being sent - progress to next data chunk or
\r
uint16_t MaxSegSize = uip_mss();
\r
\r
/* No more bytes remaining in the current data being sent - progress to next data chunk or
\r
@@
-108,15
+109,15
@@
void WebserverApp_Callback(void)
if (!(BytesRemaining))
\r
{
\r
/* Check which data chunk we are currently sending (header or data) */
\r
if (!(BytesRemaining))
\r
{
\r
/* Check which data chunk we are currently sending (header or data) */
\r
- if (
uip_conn->appstate.
CurrentState == WEBSERVER_STATE_SendHeaders)
\r
+ if (
AppState->
CurrentState == WEBSERVER_STATE_SendHeaders)
\r
{
\r
{
\r
-
uip_conn->appstate.
SendPos = HTTPPage;
\r
- uip_conn->appstate.CurrentState = WEBSERVER_STATE_SendData;
\r
+
AppState->
SendPos = HTTPPage;
\r
+ AppState->CurrentState = WEBSERVER_STATE_SendData;
\r
}
\r
}
\r
- else if (
uip_conn->appstate.
CurrentState == WEBSERVER_STATE_SendData)
\r
+ else if (
AppState->
CurrentState == WEBSERVER_STATE_SendData)
\r
{
\r
uip_close();
\r
{
\r
uip_close();
\r
-
uip_conn->appstate.
CurrentState = WEBSERVER_STATE_Closed;
\r
+
AppState->
CurrentState = WEBSERVER_STATE_Closed;
\r
}
\r
\r
return;
\r
}
\r
\r
return;
\r
@@
-133,9
+134,9
@@
void WebserverApp_Callback(void)
}
\r
\r
/* Copy over the next data segment to the application buffer, advance send position pointer */
\r
}
\r
\r
/* Copy over the next data segment to the application buffer, advance send position pointer */
\r
- strncpy_P(
uip_appdata, uip_conn->appstate.
SendPos, AppDataSize);
\r
-
uip_conn->appstate.
SendPos += AppDataSize;
\r
+ strncpy_P(
AppData, AppState->
SendPos, AppDataSize);
\r
+
AppState->
SendPos += AppDataSize;
\r
\r
/* Send the data to the requesting host */
\r
\r
/* Send the data to the requesting host */
\r
- uip_send(AppData
Ptr
, AppDataSize);
\r
+ uip_send(AppData, AppDataSize);
\r
}
\r
}
\r