8000 ESP8266WebServer - Drop inactive connection when another is waiting to improve page load time by aWZHY0yQH81uOYvH · Pull Request #8216 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

ESP8266WebServer - Drop inactive connection when another is waiting to improve page load time #8216

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 3 commits into from
Oct 27, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add missing mocking methods
  • Loading branch information
d-a-v authored and aWZHY0yQH81uOYvH committed Oct 27, 2021
commit 6988f4f64be6b5860c7b03ed72d6d34be98debf3
22 changes: 21 additions & 1 deletion tests/host/common/MockWiFiServerSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void WiFiServer::begin ()
exit(EXIT_FAILURE);
}

server.sin_family = AF_INET;
server.sin_family = AF_INET;
server.sin_port = htons(mockport);
server.sin_addr.s_addr = htonl(global_source_address);
if (bind(sock, (struct sockaddr*)&server, sizeof(server)) == -1)
Expand Down Expand Up @@ -150,3 +150,23 @@ void WiFiServer::stop ()
{
close();
}

size_t WiFiServer::hasClientData ()
{
// Trivial Mocking:
// There is no waiting list of clients in this trivial mocking code,
// so the code has to act as if the tcp backlog list is full,
// and nothing is known about potential further clients.
// It could be implemented by accepting new clients and store their data until the current one is closed.
return 0;
}

bool WiFiServer::hasMaxPendingClients ()
{
// Mocking code does not consider the waiting client list,
// so it will return ::hasClient() here meaning:
// - our waiting client list does not exist
// - we consider pending number is max if a new client is waiting
// or not max if there's no new client.
return hasClient();
}
0