Skip to content

Commit 672f02f

Browse files
committed
Prevent user code from keeping lock
Ref: #414 (comment)
1 parent b680f97 commit 672f02f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/AsyncEventSource.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,12 +380,12 @@ void AsyncEventSource::_addClient(AsyncEventSourceClient *client) {
380380
}
381381

382382
void AsyncEventSource::_handleDisconnect(AsyncEventSourceClient *client) {
383-
#ifdef ESP32
384-
std::lock_guard<std::recursive_mutex> lock(_client_queue_lock);
385-
#endif
386383
if (_disconnectcb) {
387384
_disconnectcb(client);
388385
}
386+
#ifdef ESP32
387+
std::lock_guard<std::recursive_mutex> lock(_client_queue_lock);
388+
#endif
389389
for (auto i = _clients.begin(); i != _clients.end(); ++i) {
390390
if (i->get() == client) {
391391
_clients.erase(i);

0 commit comments

Comments
 (0)