Skip to content

Commit

Permalink
Disable ASYNCWEBSERVER_USE_CHUNK_INFLIGHT by default and updated doc
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieucarbou committed Jan 22, 2025
1 parent fca0939 commit 1d154df
Show file tree
Hide file tree
Showing 4 changed files with 8 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-no-chunk-inflight
- env: ci-arduino-3-chunk-inflight
board: esp32dev

- env: ci-esp8266
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ 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`.

## `AsyncWebSocketMessageBuffer` and `makeBuffer()`

The fork from [yubox-node-org](https://github.com/yubox-node-org/ESPAsyncWebServer) introduces some breaking API changes compared to the original library, especially regarding the use of `std::shared_ptr<std::vector<uint8_t>>` for WebSocket.
Expand Down
8 changes: 4 additions & 4 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-no-chunk-inflight]
[env:arduino-3-chunk-inflight]
build_flags = ${env.build_flags}
-D ASYNCWEBSERVER_USE_CHUNK_INFLIGHT=0
-D ASYNCWEBSERVER_USE_CHUNK_INFLIGHT=1

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

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

[env:ci-esp8266]
platform = espressif8266
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 1
#define ASYNCWEBSERVER_USE_CHUNK_INFLIGHT 0
#endif

class AsyncWebServer;
Expand Down

0 comments on commit 1d154df

Please sign in to comment.