feat(websocket): add events for begin/end thread

Add events to signal the start and end of the
websocket thread handler, only once each per client.
This commit is contained in:
Richard Allen committed 2024-08-16 14:45:54 -05:00
1 parent 9cf4163663
commit d7fa24bc20
5 files changed
+18

No files matched your search

@@ -970,6 +970,7 @@ static void esp_websocket_client_task(void *pv)
client->state = WEBSOCKET_STATE_INIT;
xEventGroupClearBits(client->status_bits, STOPPED_BIT | CLOSE_FRAME_SENT_BIT);
esp_websocket_client_dispatch_event(client, WEBSOCKET_EVENT_BEGIN, NULL, 0);
int read_select = 0;
while (client->run) {
if (xSemaphoreTakeRecursive(client->lock, lock_timeout) != pdPASS) {
@@ -1104,6 +1105,7 @@ static void esp_websocket_client_task(void *pv)
}
}
esp_websocket_client_dispatch_event(client, WEBSOCKET_EVENT_FINISH, NULL, 0);
esp_transport_close(client->transport);
xEventGroupSetBits(client->status_bits, STOPPED_BIT);
client->state = WEBSOCKET_STATE_UNKNOW;