Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/core/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,9 @@ static int run_interactive_mode(void) {
}
#ifdef ENABLE_UI
g_info("Starting UI server...");
start_ui_server(g_context);
if (!start_ui_server(g_context)) {
g_warning("UI server failed to start; continuing without UI");
}
#endif

// Set up signal handlers
Expand Down
4 changes: 2 additions & 2 deletions src/core/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ static gboolean on_incoming_connection(GSocketService *service,
// Queue for processing
GError *error = NULL;
if (!g_thread_pool_push(context->worker_pool, conn, &error)) {
g_error("Failed to queue connection: %s", error->message);
g_error_free(error);
g_warning("Failed to queue connection %lu: %s", conn->id, error ? error->message : "unknown error");
g_clear_error(&error);

// Remove from table
g_mutex_lock(&context->network->connection_mutex);
Expand Down
11 changes: 7 additions & 4 deletions src/ui/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <microhttpd.h>
#include "core/plugins.h"

Expand Down Expand Up @@ -129,7 +130,7 @@ request_handler(void *cls,
/* ---------- Server lifecycle ---------- */
static struct MHD_Daemon *ui_daemon = NULL;

void start_ui_server(DeadlightContext *context)
gboolean start_ui_server(DeadlightContext *context)
{
const unsigned short ui_port = 8081;

Expand All @@ -141,10 +142,12 @@ void start_ui_server(DeadlightContext *context)
context,
MHD_OPTION_END);
if (!ui_daemon) {
g_error("Failed to start UI daemon on port %u", ui_port);
} else {
g_info("UI server listening on http://127.0.0.1:%u", ui_port);
g_warning("Failed to start UI daemon on port %u: %s", ui_port, g_strerror(errno));
return FALSE;
}

g_info("UI server listening on http://127.0.0.1:%u", ui_port);
return TRUE;
}

void stop_ui_server(void)
Expand Down
3 changes: 1 addition & 2 deletions src/ui/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
#define UI_H

#include "core/deadlight.h"
#include <microhttpd.h>

void start_ui_server(DeadlightContext *context);
gboolean start_ui_server(DeadlightContext *context);

void stop_ui_server(void);

Expand Down