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 129:6d9bffc72676, committed 2019-09-01
- Comitter:
- andrewboyson
- Date:
- Sun Sep 01 18:12:48 2019 +0000
- Parent:
- 128:fc9708e1d17c
- Child:
- 130:9a5b8fe308f1
- Commit message:
- Tidied up connection checks
Changed in this revision
| web.c | Show annotated file Show diff for this revision Revisions of this file |
--- a/web.c Wed Aug 28 07:12:39 2019 +0000
+++ b/web.c Sun Sep 01 18:12:48 2019 +0000
@@ -52,13 +52,19 @@
}
static void handleRequest(int connectionId, int size, char* pRequestStream, uint32_t positionInRequestStream)
{
- struct WebConnection* pConnection = NULL;
- if (!positionInRequestStream) pConnection = WebConnectionNew(connectionId);
- else pConnection = WebConnectionOrNull(connectionId);
- if (!pConnection)
+ struct WebConnection* pConnection;
+ if (!positionInRequestStream)
+ {
+ pConnection = WebConnectionNew(connectionId);
+ }
+ else
{
- LogTimeF("WebRequest - no connection corresponds to id %d\r\n", connectionId);
- return;
+ pConnection = WebConnectionOrNull(connectionId);
+ if (!pConnection)
+ {
+ LogTimeF("WebRequest - no connection corresponds to id %d\r\n", connectionId);
+ return;
+ }
}
pConnection->delayUntil = MsTimerCount; //Default to no delay unless modified;
@@ -120,7 +126,7 @@
static bool pollSomethingToSend(int connectionId, bool clientFinished) //returns true if finished; false if not;
{
struct WebConnection* pConnection = WebConnectionOrNull(connectionId);
- if (!pConnection) return false;
+ if (!pConnection) return false; //Protects the gap between the connection being established and the request being started
if (!pConnection->toDo)
{