aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/Webserver/Lib/HTTPServerApp.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-02-19 00:07:22 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-02-19 00:07:22 +0000
commit04d40897cf98469b39f1d97208a51deb65f70bc5 (patch)
tree0c489f8ee76bc929fbff2afe99149def8ca325fd /Projects/Webserver/Lib/HTTPServerApp.c
parent42b850f2b94941066c36d85b4878d6a348260b4d (diff)
downloadlufa-04d40897cf98469b39f1d97208a51deb65f70bc5.tar.gz
lufa-04d40897cf98469b39f1d97208a51deb65f70bc5.tar.bz2
lufa-04d40897cf98469b39f1d97208a51deb65f70bc5.zip
Commit for the 100219 release.
Diffstat (limited to 'Projects/Webserver/Lib/HTTPServerApp.c')
-rw-r--r--Projects/Webserver/Lib/HTTPServerApp.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/Projects/Webserver/Lib/HTTPServerApp.c b/Projects/Webserver/Lib/HTTPServerApp.c
index b6277d3db..4e00952f3 100644
--- a/Projects/Webserver/Lib/HTTPServerApp.c
+++ b/Projects/Webserver/Lib/HTTPServerApp.c
@@ -100,13 +100,9 @@ void HTTPServerApp_Callback(void)
if (uip_aborted() || uip_timedout() || uip_closed())
{
- /* Connection is being terminated for some reason - close file handle */
- f_close(&AppState->HTTPServer.FileHandle);
- AppState->HTTPServer.FileOpen = false;
-
/* Lock to the closed state so that no further processing will occur on the connection */
- AppState->HTTPServer.CurrentState = WEBSERVER_STATE_Closed;
- AppState->HTTPServer.NextState = WEBSERVER_STATE_Closed;
+ AppState->HTTPServer.CurrentState = WEBSERVER_STATE_Closing;
+ AppState->HTTPServer.NextState = WEBSERVER_STATE_Closing;
}
if (uip_connected())
@@ -148,9 +144,15 @@ void HTTPServerApp_Callback(void)
HTTPServerApp_SendData();
break;
case WEBSERVER_STATE_Closing:
+ /* Connection is being terminated for some reason - close file handle */
+ f_close(&AppState->HTTPServer.FileHandle);
+ AppState->HTTPServer.FileOpen = false;
+
+ /* If connection is not already closed, close it */
uip_close();
- AppState->HTTPServer.NextState = WEBSERVER_STATE_Closed;
+ AppState->HTTPServer.CurrentState = WEBSERVER_STATE_Closed;
+ AppState->HTTPServer.NextState = WEBSERVER_STATE_Closed;
break;
}
}