Skip to content

Commit 373cc18

Browse files
committed
fix: fix m3u/epg reload not working without config file specified
1 parent 650614e commit 373cc18

File tree

4 files changed

+11
-19
lines changed

4 files changed

+11
-19
lines changed

src/configuration.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -750,9 +750,6 @@ void config_free(bool force_free) {
750750
/* Free EPG cache */
751751
epg_cleanup();
752752

753-
/* Free external M3U cache */
754-
m3u_reset_external_playlist();
755-
756753
/* Free string config values */
757754
if (!cmd_hostname_set || force_free)
758755
safe_free_string(&config.hostname);
@@ -851,8 +848,10 @@ int config_reload(int *out_bind_changed) {
851848
bindaddr_t *old_bind_addresses;
852849

853850
if (!config_file_path) {
854-
logger(LOG_ERROR, "No config file path set, cannot reload");
855-
return -1;
851+
logger(LOG_INFO, "Only reload M3U/EPG, skipping configuration reload "
852+
"(config file path not set)");
853+
config.last_external_m3u_update_time = 0;
854+
return 0;
856855
}
857856

858857
/* Save current bind addresses for comparison and potential rollback */

src/supervisor.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,6 @@ int supervisor_run(void) {
313313

314314
int bind_changed = 0;
315315
if (config_reload(&bind_changed) == 0) {
316-
logger(LOG_INFO, "Configuration reloaded successfully");
317-
318316
/* Handle worker count changes */
319317
if (config.workers > num_workers) {
320318
if (bind_changed) {

src/utils.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "configuration.h"
33
#include "rtp2httpd.h"
44
#include "status.h"
5+
#include "supervisor.h"
56
#include <stdarg.h>
67
#include <stdint.h>
78
#include <stdio.h>
@@ -63,15 +64,11 @@ int logger(loglevel_t level, const char *format, ...) {
6364
}
6465

6566
if (current_level >= level) {
66-
/* Add worker_id prefix only if multiple workers
67-
* worker_id == -1 indicates supervisor process */
68-
if (config.workers > 1) {
69-
if (worker_id == -1) {
70-
prefix_len = snprintf(message, sizeof(message), "[Supervisor] ");
71-
} else {
72-
prefix_len =
73-
snprintf(message, sizeof(message), "[Worker %d] ", worker_id);
74-
}
67+
if (worker_id == SUPERVISOR_WORKER_ID) {
68+
prefix_len = snprintf(message, sizeof(message), "[Supervisor] ");
69+
} else {
70+
prefix_len =
71+
snprintf(message, sizeof(message), "[Worker %d] ", worker_id);
7572
}
7673

7774
/* Format the actual message after the prefix (if any) */

src/worker.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,7 @@ int worker_run_event_loop(int *listen_sockets, int num_sockets, int notif_fd) {
291291
reload_flag = 0;
292292
logger(LOG_INFO, "Received SIGHUP, reloading configuration");
293293

294-
if (config_reload(NULL) == 0) {
295-
logger(LOG_INFO, "Configuration reloaded successfully");
296-
} else {
294+
if (config_reload(NULL) != 0) {
297295
logger(LOG_ERROR, "Configuration reload failed, keeping old config");
298296
}
299297
}

0 commit comments

Comments
 (0)