upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/rpc.cpp
diff options
context:
space:
mode:
authorBitflash <btf01@proton.me>2026-08-01 13:10:23 -0300
committerGitHub <noreply@github.com>2026-08-01 13:10:23 -0300
commit21c8bb63cb85f3001ddee9237b1d7e689675d293 (patch)
tree9668f6bf39635424a6180c7a7edb6c7931ea7545 /src/rpc.cpp
parent7131c30c33c980f0ba1d37dfc6a3fbe8c319813e (diff)
diag: count sockets by where they were created, and whether the close took (#86)
A node was found holding 1502 sockets in Windows bound state, one ephemeral port each, 9% of the machine range in nineteen hours. Reading the code did not find it: every connect() failure path here closes its socket. So count. Every socket is tagged at creation and untagged at close, across all ten sites, with a counter for closes that fail. Already rules out three explanations: nothing is created or closed behind the counter (untagged closes are zero), no close is failing, and the leaked sockets are not in the live set -- tracked live matches what the OS reports as established, while the bound pile is something the program already closed successfully.
Diffstat (limited to 'src/rpc.cpp')
-rw-r--r--src/rpc.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rpc.cpp b/src/rpc.cpp
index 97d8429..41c0328 100644
--- a/src/rpc.cpp
+++ b/src/rpc.cpp
@@ -46,10 +46,10 @@
46using json = nlohmann::json; 46using json = nlohmann::json;
47 47
48#ifdef _WIN32 48#ifdef _WIN32
49#define sock_close(s) closesocket(s) 49#define sock_close(s) BtfCloseSocket(s)
50#define SEND_FLAGS 0 50#define SEND_FLAGS 0
51#else 51#else
52#define sock_close(s) ::close(s) 52#define sock_close(s) BtfCloseSocket(s)
53#define SEND_FLAGS MSG_NOSIGNAL 53#define SEND_FLAGS MSG_NOSIGNAL
54#endif 54#endif
55 55