upleb.uk

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

summaryrefslogtreecommitdiff
path: root/relay/btfrv.cpp
AgeCommit message (Collapse)Author
2026-07-31relay: drop registrations whose far end is gone (#65)Bitflash
A service registers at the relay and its socket sits in the waiting map until a client dials it. Nothing ever checked whether that service was still there. A node that went away left its registration behind, and the next client to ask for that key got paired with a corpse: both sides were told the pairing succeeded, then the tunnel failed with nothing to explain it. That is the "tunnel to X failed" line the dialling node reports. A reaper walks the waiting map every 60 seconds and drops registrations whose far end is provably gone, and the pairing path checks the same thing before handing a registration over, so a client gets a clean refusal instead of a broken tunnel. Provably gone means: the socket became readable and recv returned 0 or an error. A registered service sends nothing while it waits, so readable is already abnormal; recv distinguishes a closed peer from anything else. Sockets that are simply idle are left alone. select() rather than MSG_DONTWAIT so this compiles on Windows and never touches the socket's blocking mode. Deliberately no expiry by age. Nodes older than v1.2.7 register once and block forever waiting to be dialled -- they never re-register, so a clock based rule would quietly make every one of them unreachable, and being blocked in recv they would never find out. Only provable death counts. Known limit: this catches a peer that closed or reset, not one whose path died silently with no FIN. Detecting that needs a probe, and there is no byte the relay can send to a waiting service without corrupting the protocol it is waiting on. Verified on the VPS on a spare port: a node registered, was killed with SIGKILL, and the next reaper pass logged "reaper: dropped 1 dead registration(s), 0 waiting".
2026-07-24Bitflash: fair-launch releaseBitflash-sh
Satoshi's bitcoin-0.1.0 reborn with RandomX CPU proof of work, anonymous .btf addressing over Nostr with CGNAT rendezvous, automatic peer discovery, a headless Linux node, and Windows GUI wallet. Fair launch, no premine, 21M cap.