Skip to content
Snippets Groups Projects
Commit 0d8ea19e authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Create node#/client.ini for each node client connection

Paves the way for utilities like umonitor to show client details for node connections (e.g. IP address, hostname, connection duration, etc.)
parent 0b8dfdf0
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #1016 passed
......@@ -3533,6 +3533,19 @@ bool sbbs_t::init()
}
inet_addrtop(&addr, local_addr, sizeof(local_addr));
inet_addrtop(&client_addr, client_ipaddr, sizeof(client_ipaddr));
SAFEPRINTF(str, "%sclient.ini", cfg.node_dir);
FILE* fp = fopen(str, "wt");
if(fp != NULL) {
fprintf(fp, "sock=%d\n", client_socket);
fprintf(fp, "addr=%s\n", client.addr);
fprintf(fp, "host=%s\n", client.host);
fprintf(fp, "port=%u\n", (uint)client.port);
fprintf(fp, "time=%lu\n", (ulong)client.time);
fprintf(fp, "prot=%s\n", client.protocol);
fprintf(fp, "local_addr=%s\n", local_addr);
fprintf(fp, "local_port=%u\n", (uint)inet_addrport(&addr));
fclose(fp);
}
lprintf(LOG_INFO,"socket %u attached to local interface %s port %u"
,client_socket, local_addr, inet_addrport(&addr));
spymsg("Connected");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment