Skip to content

Update WiFiClient.cpp #3608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 20, 2020
Merged

Update WiFiClient.cpp #3608

merged 2 commits into from
Jan 20, 2020

Conversation

Vigeant
Copy link
Contributor

@Vigeant Vigeant commented Jan 2, 2020

fixed the connected() function so that it only checks errno if recv returns a value of -1.

"in the even of an error, errno is set to indicate the error" --manpage

This fixes the ESP32 Webserver when dealing with a modern webserver with a slow SD card.

Vigeant and others added 2 commits January 1, 2020 22:01
fixed the connected() function so that it only checks errno if recv returns a value of -1.

"in the even of an error, errno is set to indicate the error" --manpage

This fixes the ESP32 Webserver when dealing with a modern webserver with a slow SD card.
@me-no-dev me-no-dev merged commit 89351e3 into espressif:master Jan 20, 2020
@me-no-dev
Copy link
Member

thanks :)

@NathanSweet
Copy link

NathanSweet commented Dec 25, 2021

Why is _connected = true; here? IMO an unexpected error should disconnect.

              default:
                  log_i("Unexpected: RES: %d, ERR: %d", res, errno);
                  _connected = true;
                  break;

I call client.connected() every loop. When my client disconnects, I'm getting flooded with:

14:29:00.846 -> [615859][I][WiFiClient.cpp:531] connected(): Unexpected: RES: -1, ERR: 9
14:44:00.216 -> [ 58760][E][WiFiClient.cpp:477] available(): fail on fd 0, errno: 9, "Bad file number"

Error 9 seems to be "bad file number" and so the client should be considered disconnected.

@Vigeant Vigeant deleted the patch-1 branch January 18, 2022 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants