Skip to content

Commit ce5d843

Browse files
committed
Fix _addClient to avoid locking in user callback
1 parent 672f02f commit ce5d843

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/AsyncEventSource.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,16 @@ void AsyncEventSource::_addClient(AsyncEventSourceClient *client) {
368368
if (!client) {
369369
return;
370370
}
371+
372+
if (_connectcb) {
373+
_connectcb(client);
374+
}
375+
371376
#ifdef ESP32
372377
std::lock_guard<std::recursive_mutex> lock(_client_queue_lock);
373378
#endif
379+
374380
_clients.emplace_back(client);
375-
if (_connectcb) {
376-
_connectcb(client);
377-
}
378381

379382
_adjust_inflight_window();
380383
}

0 commit comments

Comments
 (0)