Skip to content

Commit

Permalink
fix: Set ASYNCWEBSERVER_USE_CHUNK_INFLIGHT to 1 by default
Browse files Browse the repository at this point in the history
See explanation here: #7 (comment)
  • Loading branch information
mathieucarbou committed Jan 23, 2025
1 parent f99decc commit 16013ef
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
- env: ci-arduino-3-no-json
board: esp32dev

- env: ci-arduino-3-chunk-inflight
- env: ci-arduino-3-no-chunk-inflight
board: esp32dev

- env: ci-esp8266
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ I personally use the following configuration in my projects:
-D CONFIG_ASYNC_TCP_STACK_SIZE=4096 // reduce the stack size (default is 16K)
```

If you need to server long / slow requests using chunk encoding (like fiel download from SD Card), you might need to set `-D ASYNCWEBSERVER_USE_CHUNK_INFLIGHT=1`.
If you need to serve chunk requests with a really low buffer (which should be avoided), you can set `-D ASYNCWEBSERVER_USE_CHUNK_INFLIGHT=0` to disable the in-flight control.

## `AsyncWebSocketMessageBuffer` and `makeBuffer()`

Expand Down
6 changes: 3 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ lib_deps =
; board = esp32-s3-devkitc-1
; board = esp32-c6-devkitc-1

[env:arduino-3-chunk-inflight]
[env:arduino-3-no-chunk-inflight]
build_flags = ${env.build_flags}
-D ASYNCWEBSERVER_USE_CHUNK_INFLIGHT=1
-D ASYNCWEBSERVER_USE_CHUNK_INFLIGHT=0

[env:perf-test-AsyncTCP]
build_flags = ${env.build_flags}
Expand Down Expand Up @@ -98,7 +98,7 @@ board = ${sysenv.PIO_BOARD}
lib_deps =
ESP32Async/AsyncTCP @ 3.3.2

[env:ci-arduino-3-chunk-inflight]
[env:ci-arduino-3-no-chunk-inflight]
board = ${sysenv.PIO_BOARD}
build_flags = ${env.build_flags}
-D ASYNCWEBSERVER_USE_CHUNK_INFLIGHT=1
Expand Down
2 changes: 1 addition & 1 deletion src/ESPAsyncWebServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
// See https://github.com/ESP32Async/ESPAsyncWebServer/commit/3d3456e9e81502a477f6498c44d0691499dda8f9#diff-646b25b11691c11dce25529e3abce843f0ba4bd07ab75ec9eee7e72b06dbf13fR388-R392
// This setting slowdown chunk serving but avoids crashing or deadlocks in the case where slow chunk responses are created, like file serving form SD Card
#ifndef ASYNCWEBSERVER_USE_CHUNK_INFLIGHT
#define ASYNCWEBSERVER_USE_CHUNK_INFLIGHT 0
#define ASYNCWEBSERVER_USE_CHUNK_INFLIGHT 1
#endif

class AsyncWebServer;
Expand Down

0 comments on commit 16013ef

Please sign in to comment.