OverviewFilesCommitsIssuesDocsReleasesPeers

hyperswarm-peer commits / 67d40c6

swarmd: the transport object cache compared against the wrong file
Each cached peer object was checked against its OWN .cpp only. A change to a shared HEADER left every one of them stale and silently reusable — a class layout, or in today's case compact_encoding.h acquiring a dependency the cached objects had never been compiled with. That is precisely the half-updated cache daemon/build.sh refuses to link, with the reason written above it: a class layout is a contract between translation units, and an object compiled before the header changed cannot be trusted. This script had the cache and not the guard. It now compares against the newest of src/*.h and src/*.cpp, the same rule. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
67d40c6e9203aaabd2ade94cd2efe4829217bbbb
by plankatron <fleeky@gmail.com> · 2026-09-10T18:59:58.000Z

Changed files (1) +10 -2

swarmd/build.sh +10 -2
……@@ -47,10 +47,18 @@ echo "Building transport..."
4747TOBJ=${TOBJ:-/tmp/hsp-obj}
4848PEERSRC="noise_ik noise_handshake noise_stream dht_rpc holepuncher hyperdht dht_connector udx_transport swarm_manager protomux"
4949TLIBS=""
50# ⛔ AGAINST THE NEWEST HEADER, NOT THE .cpp. This compared each object with its
51# own source only, so a change to a shared HEADER — a class layout, or
52# compact_encoding.h growing a new dependency — left every object here stale and
53# silently reusable. That is the half-updated cache ../daemon/build.sh already
54# refuses to link, and it was reachable from this script.
55PEERNEW=$(ls -t "$PEER"/src/*.h "$PEER"/src/*.cpp | head -1)
5056for n in $PEERSRC; do
5157 o="$OBJ/peer_$n.o"
52 if [ ! -f "$o" ] || [ "$PEER/src/$n.cpp" -nt "$o" ]; then
53 g++ -std=c++17 -O2 -D_GNU_SOURCE -I$PEER/src -I$PEER/thirdparty/libudx/include -c -o "$o" "$PEER/src/$n.cpp"
58 if [ ! -f "$o" ] || [ "$PEERNEW" -nt "$o" ]; then
59 g++ -std=c++17 -O2 -D_GNU_SOURCE -I$PEER/src -I$PEER/thirdparty/libudx/include \
60 -I$KB/tier5/libcompact/include -I$KB/tier4/libutf/include \
61 -c -o "$o" "$PEER/src/$n.cpp"
5462 fi
5563 TLIBS="$TLIBS $o"
5664done