usedbytes / picowota

A bootloader for OTA WiFi code upload to a Raspberry Pi Pico W
BSD 3-Clause "New" or "Revised" License
113 stars 21 forks source link

Time-Sensitive TCP server #5

Open felixdoerre opened 1 year ago

felixdoerre commented 1 year ago

Hi,

I've got an explanation for this bug: https://github.com/usedbytes/serial-flash/blob/51e30aae59cde7daa17cb43accabf6d1315964b8/main.go#L80

What happens:

A fix seems to be, that the gpio pin is not turned on directly inside an lwip callback, but dispatched to the main loop as an event.

In general the TCP implementation seems to be very sensitive to timing/packeting. Sending multiple commands at once or sending commands before having received the previous reply confuses the handling code, resulting in skipped data, or plain hangups. This is generally not expected from TCP peers. Is it desired to make the tcp client more robust against this?

usedbytes commented 11 months ago

Sorry I missed this - thanks so much for your investigation! If you open a pull request I'd be happy to merge that in