2 Commits

Author SHA1 Message Date
Nils 6d16baf052 Merge branch 'main' of https://github.com/nils-kt/Easy-IRL-Stream 2026-04-29 15:56:40 +02:00
Nils 8b05e85683 Refactor event handler logic to improve connection state management
- Updated the event handler to ensure that the disconnected state is only bypassed if the connection is not in the listening state.
- Enhanced the condition for returning early from the function to include a check for `disc_time` being zero, improving the handling of disconnection timeouts.
2026-04-29 15:56:33 +02:00
+2 -2
View File
@@ -374,7 +374,7 @@ void event_handler_tick(struct irl_source_data *data)
if (state == CONN_STATE_CONNECTED)
check_quality(data);
if (state != CONN_STATE_DISCONNECTED)
if (state != CONN_STATE_DISCONNECTED && state != CONN_STATE_LISTENING)
return;
pthread_mutex_lock(&data->mutex);
@@ -383,7 +383,7 @@ void event_handler_tick(struct irl_source_data *data)
int timeout = data->disconnect_timeout_sec;
pthread_mutex_unlock(&data->mutex);
if (already_fired || timeout <= 0)
if (already_fired || timeout <= 0 || disc_time == 0)
return;
uint64_t elapsed_ns = os_gettime_ns() - disc_time;