mirror of
https://github.com/me-no-dev/ESPAsyncWebServer.git
synced 2026-02-04 22:25:06 +01:00
AsyncEventSource - replace _clients with std::list
use a list of unique_ptrs for _clients container
This commit is contained in:
committed by
Mathieu Carbou
parent
a1627af702
commit
bb4eb89c8e
@@ -110,17 +110,17 @@ class AsyncEventSourceClient {
|
||||
class AsyncEventSource: public AsyncWebHandler {
|
||||
private:
|
||||
String _url;
|
||||
LinkedList<AsyncEventSourceClient *> _clients;
|
||||
std::list< std::unique_ptr<AsyncEventSourceClient> > _clients;
|
||||
#ifdef ESP32
|
||||
// Same as for individual messages, protect mutations of _clients list
|
||||
// since simultaneous access from different tasks is possible
|
||||
mutable std::mutex _client_queue_lock;
|
||||
#endif
|
||||
ArEventHandlerFunction _connectcb;
|
||||
ArEventHandlerFunction _connectcb{nullptr};
|
||||
ArAuthorizeConnectHandler _authorizeConnectHandler;
|
||||
public:
|
||||
AsyncEventSource(const String& url);
|
||||
~AsyncEventSource();
|
||||
AsyncEventSource(const String& url) : _url(url){};
|
||||
~AsyncEventSource(){ close(); };
|
||||
|
||||
const char * url() const { return _url.c_str(); }
|
||||
void close();
|
||||
|
||||
Reference in New Issue
Block a user