Skip to content

Misc design-question TODOs worth a look (fixed capacities, stale comment, eviction edge case) #75

Description

@davidchatting-bot

A grab-bag of smaller `TODO` comments in `src/` that don't warrant their own issue individually but are worth a punch-list:

  • `YoYoWiFiManager.h:98` - `StaticJsonDocument<8192> broadcastMessageList; //TODO: this should be dynamic?` - fixed 8KB capacity for the queue of messages waiting to be broadcast to peers; worth deciding if that's enough headroom or should be a `DynamicJsonDocument`.
  • `YoYoWiFiManager.cpp`, `onYoYoRequestPOST()`/dead code in `onYoYoRequestDELETE()` - `//TODO: this limit seems artificial` (x2) - the 1024-byte fixed buffer for incoming JSON POST/DELETE bodies; worth deciding if that's an intentional ceiling (memory-constrained device) or should be configurable/dynamic.
  • `YoYoWiFiManager.cpp`, `onYoYoMessagePOST()` - `request->send(200, "application/javascript", getCredentialsAsJsonString()); //TODO: is this the problem?` - looks like a leftover debugging note from investigating what's now closed issue POSTing to /yoyo/credentials does not return a code #16; worth confirming it's no longer suspect and removing the comment.
  • `YoYoWiFiManager.cpp`, `getCredentialsAsJsonString()` - `serializeJson(jsonDoc, jsonString); //TODO: test length` - unlike the fixed `char*` buffers elsewhere (see Heap buffer overflow: unbounded strcpy of untrusted JSON in setCredentials() #56/Unbounded strcpy(response, ...) in POST()/GET() HTTP client helpers #68), this serializes into a `String`, so it's not an overflow risk, just worth confirming there's no practical size ceiling worth handling.
  • `YoYoWiFiManager.cpp`, `getCredentialsAsJson()` - `//TODO: should in same structure - just missing the password field or replacing with s` - a design comment about whether starring-out passwords (`***`) vs. omitting the `password` field entirely is the better shape for `GET /yoyo/credentials`'s response.
  • `YoYoSettings.h:53` - `while(force && isFull()) removeNetwork(0, false); //...TODO: should it delete this network if lastnetwork is set true?` - when storage is full, the oldest network (index 0) is evicted to make room for a new one; open question of whether it should skip/protect the network currently flagged `lastnetwork` (the one actively in use) from eviction.
  • `YoYoWiFiManager/wifi_sta.h:4` - `#define ESP_WIFI_MAX_CONN_NUM (10) //TODO: is this right? This is the max for ESP32` - this constant is used in the ESP8266 branch of `updateClientList()` but the comment notes it's actually the ESP32 max; worth confirming the correct ESP8266 station limit and using that instead.

None of these are known-broken today as far as I've found - more a list of open design questions/cleanup left by the original TODOs, grouped here rather than as one-line issues each.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions