v1.2.47 - Fix build: use getter function for g_connection_count (was static, can't extern)

This commit is contained in:
Your Name
2026-02-25 07:24:17 -04:00
parent a1f712236a
commit 63bc526163
4 changed files with 9 additions and 4 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ extern void log_query_execution(const char* query_type, const char* sub_id,
#include <pthread.h>
#include <libwebsockets.h>
#include <cjson/cJSON.h>
extern int g_connection_count;
int get_active_connection_count(void);
#include <sqlite3.h>
#include <time.h>
#include <sys/stat.h>
@@ -1293,7 +1293,7 @@ cJSON* query_cpu_metrics(void) {
cJSON_AddNumberToObject(cpu_stats, "process_id", (double)pid);
// Get active WebSocket connection count
cJSON_AddNumberToObject(cpu_stats, "active_connections", (double)g_connection_count);
cJSON_AddNumberToObject(cpu_stats, "active_connections", (double)get_active_connection_count());
// Get memory usage from /proc/self/status
FILE* mem_stat = fopen("/proc/self/status", "r");
+2 -2
View File
@@ -13,8 +13,8 @@
// Using CRELAY_ prefix to avoid conflicts with nostr_core_lib VERSION macros
#define CRELAY_VERSION_MAJOR 1
#define CRELAY_VERSION_MINOR 2
#define CRELAY_VERSION_PATCH 46
#define CRELAY_VERSION "v1.2.46"
#define CRELAY_VERSION_PATCH 47
#define CRELAY_VERSION "v1.2.47"
// Relay metadata (authoritative source for NIP-11 information)
#define RELAY_NAME "C-Relay"
+2
View File
@@ -130,6 +130,8 @@ static tracked_connection_t g_connections[MAX_TRACKED_CONNECTIONS];
static int g_connection_count = 0;
static pthread_mutex_t g_connections_lock = PTHREAD_MUTEX_INITIALIZER;
int get_active_connection_count(void) { return g_connection_count; }
static void connection_list_add(struct lws* wsi, struct per_session_data* pss) {
pthread_mutex_lock(&g_connections_lock);
for (int i = 0; i < MAX_TRACKED_CONNECTIONS; i++) {
+3
View File
@@ -96,6 +96,9 @@ struct per_session_data {
int is_websocket; // 1 if this is a WebSocket connection, 0 for HTTP
};
// Get current active WebSocket connection count
int get_active_connection_count(void);
// NIP-11 HTTP session data structure for managing buffer lifetime
struct nip11_session_data {
int type; // 0 for NIP-11