Skip to content
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

make http-server less verbose in debug mode #8850

Merged
merged 4 commits into from
Feb 5, 2023
Merged
Changes from all commits
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
35 changes: 29 additions & 6 deletions libraries/ESP8266WebServer/src/ESP8266WebServer-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,35 @@ void ESP8266WebServerTemplate<ServerType>::handleClient() {
bool keepCurrentClient = false;
bool callYield = false;

DBGWS("http-server loop: conn=%d avail=%d status=%s\n",
_currentClient.connected(), _currentClient.available(),
_currentStatus==HC_NONE?"none":
_currentStatus==HC_WAIT_READ?"wait-read":
_currentStatus==HC_WAIT_CLOSE?"wait-close":
"??");
#ifdef DEBUG_ESP_HTTP_SERVER

struct compare_s
{
uint8_t connected;
int available;
HTTPClientStatus status;
bool operator != (const compare_s& o)
{
return o.connected != connected
|| o.available != available
|| o.status != status;
}
};
static compare_s last { false, 0, HC_NONE };
compare_s now { _currentClient.connected(), _currentClient.available(), _currentStatus };

if (last != now)
{
DBGWS("http-server loop: conn=%d avail=%d status=%s\n",
_currentClient.connected(), _currentClient.available(),
_currentStatus==HC_NONE?"none":
_currentStatus==HC_WAIT_READ?"wait-read":
_currentStatus==HC_WAIT_CLOSE?"wait-close":
"??");
last = now;
}

#endif // DEBUG_ESP_HTTP_SERVER

if (_currentClient.connected() || _currentClient.available()) {
if (_currentClient.available() && _keepAlive) {
Expand Down