theAgingApprentice / HexaFloorRide

Arduino based six legged robot project
MIT License
0 stars 0 forks source link

Review MQTT command buffering #242

Open nerdoug opened 1 month ago

nerdoug commented 1 month ago

Need to look over buffer handling for MQTT commands sent from MQTT.fx. It seems like there is more buffer copying and shuffling and zeroing done than is actually needed. This is sensitive because these routines are asynchronous call backs that can occur anywhere, and need to be minimized.

Relevent code is in: aaStringQueue.cpp aaMqtt.cpp

nerdoug commented 1 month ago

It might be possible that an incoming MQTT message comes in while a previous message is being processed. If this happens we may need an interlock (or mutex) to ensure the buffer structure doesn't get compromised. Reference: pop routine in aaStringQueue,

Could also put traces in if a message is lost due to buffer overrun, or even if we filled the queue but didn't lose anything.

nerdoug commented 3 weeks ago

aaMqtt.cpp changes: -getCmd(): no changes

atStringQueue.cpp changes: -pop(): remove unneeded memset call which zeroes vacated buffer space -push():