\r
if (uip_aborted() || uip_timedout() || uip_closed())\r
{\r
- /* Connection is being terminated for some reason - close file handle */\r
- f_close(&AppState->HTTPServer.FileHandle);\r
- AppState->HTTPServer.FileOpen = false;\r
- \r
/* Lock to the closed state so that no further processing will occur on the connection */\r
- AppState->HTTPServer.CurrentState = WEBSERVER_STATE_Closed;\r
- AppState->HTTPServer.NextState = WEBSERVER_STATE_Closed;\r
+ AppState->HTTPServer.CurrentState = WEBSERVER_STATE_Closing;\r
+ AppState->HTTPServer.NextState = WEBSERVER_STATE_Closing;\r
}\r
\r
if (uip_connected())\r
HTTPServerApp_SendData();\r
break;\r
case WEBSERVER_STATE_Closing:\r
+ /* Connection is being terminated for some reason - close file handle */\r
+ f_close(&AppState->HTTPServer.FileHandle);\r
+ AppState->HTTPServer.FileOpen = false;\r
+ \r
+ /* If connection is not already closed, close it */\r
uip_close();\r
\r
- AppState->HTTPServer.NextState = WEBSERVER_STATE_Closed;\r
+ AppState->HTTPServer.CurrentState = WEBSERVER_STATE_Closed;\r
+ AppState->HTTPServer.NextState = WEBSERVER_STATE_Closed;\r
break;\r
} \r
} \r