Skip to content

Commit 6781a0a

Browse files
d-a-vhasenradball
authored andcommitted
make http-server less verbose in debug mode (esp8266#8850)
* make http-server less verbose in debug mode
1 parent a29ace4 commit 6781a0a

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

libraries/ESP8266WebServer/src/ESP8266WebServer-impl.h

+29-6
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,35 @@ void ESP8266WebServerTemplate<ServerType>::handleClient() {
296296
bool keepCurrentClient = false;
297297
bool callYield = false;
298298

299-
DBGWS("http-server loop: conn=%d avail=%d status=%s\n",
300-
_currentClient.connected(), _currentClient.available(),
301-
_currentStatus==HC_NONE?"none":
302-
_currentStatus==HC_WAIT_READ?"wait-read":
303-
_currentStatus==HC_WAIT_CLOSE?"wait-close":
304-
"??");
299+
#ifdef DEBUG_ESP_HTTP_SERVER
300+
301+
struct compare_s
302+
{
303+
uint8_t connected;
304+
int available;
305+
HTTPClientStatus status;
306+
bool operator != (const compare_s& o)
307+
{
308+
return o.connected != connected
309+
|| o.available != available
310+
|| o.status != status;
311+
}
312+
};
313+
static compare_s last { false, 0, HC_NONE };
314+
compare_s now { _currentClient.connected(), _currentClient.available(), _currentStatus };
315+
316+
if (last != now)
317+
{
318+
DBGWS("http-server loop: conn=%d avail=%d status=%s\n",
319+
_currentClient.connected(), _currentClient.available(),
320+
_currentStatus==HC_NONE?"none":
321+
_currentStatus==HC_WAIT_READ?"wait-read":
322+
_currentStatus==HC_WAIT_CLOSE?"wait-close":
323+
"??");
324+
last = now;
325+
}
326+
327+
#endif // DEBUG_ESP_HTTP_SERVER
305328

306329
if (_currentClient.connected() || _currentClient.available()) {
307330
if (_currentClient.available() && _keepAlive) {

0 commit comments

Comments
 (0)