Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: oldheating gps motorhome heating
Revision 127:bd6dd135009d, committed 2019-07-31
- Comitter:
- andrewboyson
- Date:
- Wed Jul 31 15:09:15 2019 +0000
- Parent:
- 126:6b547c86da6e
- Child:
- 128:fc9708e1d17c
- Commit message:
- Amalgamated Reply into Poll function
Changed in this revision
| web.c | Show annotated file Show diff for this revision Revisions of this file |
--- a/web.c Mon May 27 10:13:45 2019 +0000
+++ b/web.c Wed Jul 31 15:09:15 2019 +0000
@@ -116,24 +116,17 @@
if (!pState->postComplete) handlePost(pState->toDo, contentLength, contentStart, size, pRequestStream, positionInRequestStream, &pState->postComplete);
}
-static int pollSomethingToSend(char* pStateData, bool clientFinished) //returns 0 no; +1 yes; -1 finished;
+static bool pollSomethingToSend(char* pStateData, bool clientFinished) //returns true if finished; false if not;
{
struct state* pState = (struct state*)pStateData;
if (!pState->toDo)
{
- if (clientFinished) return -1; //The client hasn't requested anything and never will so finish
- else return 0; //The client hasn't requested anything yet but still could
+ if (clientFinished) return true; //The client hasn't requested anything and never will so finish
+ else return false; //The client hasn't requested anything yet but still could
}
- if (!pState->postComplete ) return 0; //Wait for the request (usually a POST) to finish
- if (!MsTimerAbsolute(pState->delayUntil)) return 0; //Wait a while (usually after a LOGIN attempt)
-
- return 1; //Yep, set up anything (just TSL at the moment) then call sendReply
-}
-
-static bool sendReply(char* pStateData)
-{
- struct state* pState = (struct state*)pStateData;
+ if (!pState->postComplete ) return false; //Wait for the request (usually a POST) to finish
+ if (!MsTimerAbsolute(pState->delayUntil)) return false; //Wait a while (usually after a LOGIN attempt)
int todo = pState->toDo; //Make a copy so that we don't modify todo in the state
@@ -161,7 +154,6 @@
{
HttpRequestFunction = handleRequest;
HttpPollFunction = pollSomethingToSend;
- HttpReplyFunction = sendReply;
WebLoginInit();