File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -184,10 +184,14 @@ void AsyncEventSourceClient::_queueMessage(AsyncEventSourceMessage *dataMessage)
184
184
delete dataMessage;
185
185
return ;
186
186
}
187
-
188
- _messageQueue.add (dataMessage);
189
-
190
- _runQueue ();
187
+ if (_messageQueue.length () >= SSE_MAX_QUEUED_MESSAGES){
188
+ ets_printf (" ERROR: Too many messages queued\n " );
189
+ delete dataMessage;
190
+ } else {
191
+ _messageQueue.add (dataMessage);
192
+ }
193
+ if (_client->canSend ())
194
+ _runQueue ();
191
195
}
192
196
193
197
void AsyncEventSourceClient::_onAck (size_t len, uint32_t time){
Original file line number Diff line number Diff line change 23
23
#include < Arduino.h>
24
24
#ifdef ESP32
25
25
#include < AsyncTCP.h>
26
+ #define SSE_MAX_QUEUED_MESSAGES 32
26
27
#else
27
28
#include < ESPAsyncTCP.h>
29
+ #define SSE_MAX_QUEUED_MESSAGES 8
28
30
#endif
29
31
#include < ESPAsyncWebServer.h>
30
32
33
+ #include " AsyncWebSynchronization.h"
34
+
35
+ #ifdef ESP8266
36
+ #include < Hash.h>
37
+ #ifdef CRYPTO_HASH_h // include Hash.h from espressif framework if the first include was from the crypto library
38
+ #include < ../src/Hash.h>
39
+ #endif
40
+ #endif
41
+
42
+ #ifdef ESP32
43
+ #define DEFAULT_MAX_SSE_CLIENTS 8
44
+ #else
45
+ #define DEFAULT_MAX_SSE_CLIENTS 4
46
+ #endif
47
+
31
48
class AsyncEventSource ;
32
49
class AsyncEventSourceResponse ;
33
50
class AsyncEventSourceClient ;
You can’t perform that action at this time.
0 commit comments