Network disconnect delay #20
MitchBradley
started this conversation in
General
Replies: 1 comment
-
|
I have not objections to bring the implementation closer to what the ESP32 is doing. _timeout is usually set by the setTimeout(unsigned long timeout) method of the Stream. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Thanks for all the help landing the Async stuff. The necessary changes to ESPAsyncWebServer are upstream. In testing, I have run into a couple of other issues. I can issue PRs but first I wanted to run one of the changes by you to see if there is a philosophical objection.
The test case for both issues is connecting to my app via a Telnet client. It connects and works, but when the client quits, the connection does not close. The root cause for that is a problem in the way that recv return values are interpreted. The emulator fails to notice the TCP disconnect, so the server app never sees connected() become false. I think this is a genuine semantic issue so I hope it won't be controversial.
The second, possibly controversial issue is the time delay in connected(). The connection timeout logic is different between the ESP32, Pico, and Emulator implementations. ESP has a variant of connect() with an extra timeout parameter. Pico has an _timeout variable that is set to 5000, with no obvious way to change it, that is applied during connect(). Emulator's configurable timeout (default 5000 ms) is not applied in connect(), but rather in connected(). That is a problem because applications often need to poll connected() to detect disconnects. On an established connection, connected() returns true immediately, but on a connection that just dropped, it stalls for 5 seconds. Waiting for connection establishment is expected and usual, but stalling on disconnect is not. So I think it would be better to follow the ESP and Pico patterns and apply the timeout inside connect().
Beta Was this translation helpful? Give feedback.
All reactions