commit a228b2eee3f028b2b18e23bc4882fbc64ffbc9cd Author: Mooneer Salem Date: Sat Oct 31 22:19:23 2026 -0700 Fill in the high band of RADE's input features for 8 kHz mics. An 8 kHz mic gives RADE nothing above 4 kHz to encode, so the far end hears a muffled voice even though RADE carries up to 8 kHz. RADEFeatureExpander runs a small causal model (a convolution and two 128-unit GRUs, about 208k parameters, using Opus's nnet code) that predicts the band energies and pitch correlation a 16 kHz mic would have given. RADETransmitStep::setNarrowbandInput() turns it on; MinimalTxRxThread does so for mics at 8 kHz or below. Receivers are unchanged. Through the real TX path, RADE V1 and FARGAN, energy above 4 kHz at the far end goes from -44.2 dB to -20.9 dB (a 16 kHz mic gives -19.1 dB). The model adds no delay and uses under 0.3% of a core. tools/rade_bwe has the training, evaluation and export scripts. RADEFeatureExpanderTest checks the C version against reference frames from PyTorch. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019q8F5ZSDKDxXJoLJTFQ8wN commit 3e055afd50a869d05888a1c9e6bcda7491087eb9 Author: Mooneer Salem Date: Sat Oct 31 17:28:26 2026 -0700 Wait for onConnect_() in TCP Test 60 before checking the connect count. connectImpl_() queues onConnect_() as a task of its own, behind the connect() task that resolves the returned future, so the count can still be 0 when the future is ready. The other tests already wait with waitForConnects(). Seen failing on the macOS universal build in CI. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019q8F5ZSDKDxXJoLJTFQ8wN commit 8fce8865bb0b49ebd6d37d882391d6d26a5e761f Merge: 9f5abaf 5dd2c52 Author: Mooneer Salem Date: Fri Oct 30 09:11:34 2026 -0700 Merge branch 'main' into ms-cov-extend commit a1f2b4331c375cd73575616e78fa6993ffc16115 Merge: f98ca3c b51a6bd Author: Mooneer Salem Date: Thu Oct 29 19:36:02 2026 -0700 Merge branch 'v2.0-dev' into radev2-dev commit b51a6bddf546aaef8c5739283037bef6efaf27b9 Merge: 9922bba 5dd2c52 Author: Mooneer Salem Date: Thu Oct 29 18:46:32 2026 -0700 Merge remote-tracking branch 'origin/main' into v2.0-dev-merge commit 5dd2c52faac68273824cfd5d65cb905770cb5e0a Author: Mooneer Salem Date: Thu Oct 29 18:45:33 2026 -0700 Fix bugs found while extending test coverage (#78) * Fix bugs found while extending test coverage - RADEReceiveStep::execute(): reserve room for every LPCNet frame one rade_rx() call can complete, not just one. A large enough input in a single call wrote past the end of the output buffer. - AudioPipeline::reloadResampler_(): rebuild the resampler when its output rate doesn't match the next step's input (the test was inverted), and leave a resampler that's kept alone rather than moving it onto itself, which destroyed it and later freed it twice. - ResampleStep: hold the temporary buffers in unique_ptrs and create the libsamplerate state last, so it isn't leaked if an allocation throws. Limit each chunk's output to the room left in the output buffer; one second of 8 kHz audio upsampled with the linear converter wrote 48100 samples into a 48000-sample buffer. - TcpConnectionHandler: refuse the connection when the TLS 1.2 minimum or the hostname to check the certificate against can't be set, instead of connecting without them. Give up when select() fails in the send loop rather than retrying forever; on macOS a closed socket made it spin. - Semaphore (Linux): wait() keeps waiting after EINTR, as waitFor() does, and a semaphore whose sem_init() failed is never used. - UdpHandler: stop opening after socket() fails rather than binding and joining groups with -1. - ThreadedObject (macOS): skip an empty task, as the other implementation does, instead of calling it and throwing bad_function_call. - ulog_async_flush(): give up after 2 s rather than 2000 polls. A 1 ms sleep can take ~15 ms on Windows, so with nonstop logging flush() blocked for 20 s or more there. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019q8F5ZSDKDxXJoLJTFQ8wN * Add regression tests for the pipeline fixes - AudioPipelineTest: reloadResampler_() rebuilds a resampler that no longer feeds the next step's rate, and keeps one that does intact. - RadeStepResetTest: a single large RX execute() stays within the output buffer. - ResampleTest: one second of linear 8 kHz -> 48 kHz output fits the one-second buffer. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019q8F5ZSDKDxXJoLJTFQ8wN * Build the test certificate's name separately for OpenSSL 4 OpenSSL 4's X509_get_subject_name() returns a const name, so the tests stopped compiling on the macOS runner once Homebrew's OpenSSL moved to 4. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019q8F5ZSDKDxXJoLJTFQ8wN --------- Co-authored-by: Claude Opus 5.5 commit 60053ceed4be1147b3e0f35d8b86915ff003808e Author: Mooneer Salem Date: Thu Oct 29 18:10:13 2026 -0700 Build the test certificate's name separately for OpenSSL 4 OpenSSL 4's X509_get_subject_name() returns a const name, so the tests stopped compiling on the macOS runner once Homebrew's OpenSSL moved to 4. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019q8F5ZSDKDxXJoLJTFQ8wN commit cfff5256cb5c2d710e72ad39cdfcd233cf6f9b5e Author: Mooneer Salem Date: Thu Oct 29 17:43:57 2026 -0700 Add regression tests for the pipeline fixes - AudioPipelineTest: reloadResampler_() rebuilds a resampler that no longer feeds the next step's rate, and keeps one that does intact. - RadeStepResetTest: a single large RX execute() stays within the output buffer. - ResampleTest: one second of linear 8 kHz -> 48 kHz output fits the one-second buffer. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019q8F5ZSDKDxXJoLJTFQ8wN commit 4bad49c1b66fb22cdef34ce5c9727fc24d02a02f Author: Mooneer Salem Date: Thu Oct 29 17:43:57 2026 -0700 Fix bugs found while extending test coverage - RADEReceiveStep::execute(): reserve room for every LPCNet frame one rade_rx() call can complete, not just one. A large enough input in a single call wrote past the end of the output buffer. - AudioPipeline::reloadResampler_(): rebuild the resampler when its output rate doesn't match the next step's input (the test was inverted), and leave a resampler that's kept alone rather than moving it onto itself, which destroyed it and later freed it twice. - ResampleStep: hold the temporary buffers in unique_ptrs and create the libsamplerate state last, so it isn't leaked if an allocation throws. Limit each chunk's output to the room left in the output buffer; one second of 8 kHz audio upsampled with the linear converter wrote 48100 samples into a 48000-sample buffer. - TcpConnectionHandler: refuse the connection when the TLS 1.2 minimum or the hostname to check the certificate against can't be set, instead of connecting without them. Give up when select() fails in the send loop rather than retrying forever; on macOS a closed socket made it spin. - Semaphore (Linux): wait() keeps waiting after EINTR, as waitFor() does, and a semaphore whose sem_init() failed is never used. - UdpHandler: stop opening after socket() fails rather than binding and joining groups with -1. - ThreadedObject (macOS): skip an empty task, as the other implementation does, instead of calling it and throwing bad_function_call. - ulog_async_flush(): give up after 2 s rather than 2000 polls. A 1 ms sleep can take ~15 ms on Windows, so with nonstop logging flush() blocked for 20 s or more there. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019q8F5ZSDKDxXJoLJTFQ8wN commit 9f5abafeaf664b7b92c4baf44b3a1e75d9f0d53a Author: Mooneer Salem Date: Thu Oct 29 13:56:01 2026 -0700 Put the asserts back and leave their branches out of coverage Restores the asserts removed to raise branch coverage, and the AF_INET check before UdpHandler's "should not reach here" assert. As freedv-gui's coverage job does, branches on assert() lines are no longer counted: the summary takes them off llvm-cov's own totals, matching per file what an NDEBUG build reports. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019q8F5ZSDKDxXJoLJTFQ8wN commit a10878ae3983680a3a991b62fca4c55396fb6fca Author: Mooneer Salem Date: Tue Oct 27 23:04:15 2026 -0700 Give ulog_async_flush() a 2 s limit instead of 2000 polls; compare %p with printf flush() gave up after 2000 polls with a 1 ms sleep between them, meant as ~2 s, but a 1 ms sleep can take ~15 ms on Windows, so with a producer that never stops it blocked for 20 s or more there (UlogAsyncTest Test 15 on Windows CI). Use a deadline instead. Test 13 expected %p to start with 0x, which Windows' printf doesn't do; compare with what snprintf() gives. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019q8F5ZSDKDxXJoLJTFQ8wN commit e4e1e981c76be20359c4b08946330af0b657f2e7 Author: Mooneer Salem Date: Tue Oct 27 19:15:35 2026 -0700 Fix TCP Test 61 on macOS and the Windows build of TcpConnectionHandlerTest Test 61 relied on listen(0) holding one connection, but macOS doesn't limit listen(0) at all, so the IPv4 attempt connected and IPv6 was never used. Use listen(1) and add fillers until a connect stays pending, as Test 45 does. Winsock's recv()/send() take char buffers; cast the unsigned char ones. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019q8F5ZSDKDxXJoLJTFQ8wN commit e991214edc3fa9142c30de114e76c30fd38b0037 Author: Mooneer Salem Date: Tue Oct 27 15:50:41 2026 -0700 Use _WIN32 for the Windows guards in TcpConnectionHandlerTest The MinGW build doesn't define WIN32 before the first include, so sys/resource.h was pulled in and the test failed to compile. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019q8F5ZSDKDxXJoLJTFQ8wN commit 0b0878f71f712c45c91498e481b1dfdd78bd043b Author: Mooneer Salem Date: Tue Oct 27 14:36:48 2026 -0700 Replace tests of accidental behavior; fix TCP Test 45 on macOS - ResampleStep, LinkStep: assert that rates are positive and that LinkStep's buffer fits GenericFIFO's int length, rather than relying on a negative size wrapping into a failed allocation. Remove the tests that treated that bad_alloc as input validation. - ThreadedObject: isDestroying_ is private again; remove the test that set it from a task, which production code never does. - TCP Test 55: block the client's TLS writes from SSL_set_fd (Linux --wrap shim), before the ClientHello goes out. Polling for the SSL object always came too late, so the test always skipped. - TCP Test 62: require the stalled send to end on its own now that the send loop gives up on a failed select(). - TCP Test 45: fill the listener's backlog until exactly one connect is pending. listen(4) holds 5 on Linux but 4 on macOS, where a second waiting filler took the slot meant for the handler. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019q8F5ZSDKDxXJoLJTFQ8wN commit 7d812ac4e4865721202e629e7e7865c666e9900c Author: Mooneer Salem Date: Tue Oct 27 14:12:36 2026 -0700 Fix the macOS send spin and empty-task crash; fix two unreliable tests - TcpConnectionHandler: when select() fails in the send loop (other than EINTR), give up instead of failing again forever. On macOS a closed socket made it spin, logging and queueing a disconnect on every pass. - ThreadedObject (macOS): skip an empty task, as the other implementation does, instead of calling it and throwing bad_function_call. - UlogConfigTest: drop the case that passes an 8-byte buffer as (size_t)-1 bytes; macOS's fmemopen() writes past it. - UlogAsyncTest: only require flush() to return under nonstop logging; whether it uses up its poll budget depends on scheduling. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019q8F5ZSDKDxXJoLJTFQ8wN commit 232a58e9ad4e77d516e0a0eee0e5ced1c628517d Author: Mooneer Salem Date: Tue Oct 27 13:43:51 2026 -0700 Fix bugs that coverage tests had locked in - TLS: refuse the connection when the TLS 1.2 minimum or the hostname to check the certificate against can't be set, instead of connecting without them. Tests now require the refusal. - AudioPipeline::reloadResampler_(): rebuild the resampler when its output rate doesn't match the next step's input, not when it does. - Semaphore (Linux): wait() keeps waiting after EINTR, as waitFor() does, and a semaphore whose sem_init() failed is never used. - UdpHandler: stop opening after socket() fails rather than binding and joining groups with -1. The test no longer passes on an exception. - rade_text: fill in debugString again; it was logged uninitialized. - PskReporterTest: sys/resource.h and the descriptor-limit test are non-Windows only. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019q8F5ZSDKDxXJoLJTFQ8wN commit 8deb3808cf0302c0c02a6eacf0cc3544079e9094 Author: Mooneer Salem Date: Tue Oct 27 12:05:16 2026 -0700 test: raise branch coverage to 95.7% under the CI llvm-cov metric - exclude the vendored ulog.c logging backend from the metric denominator - add --wrap fault injection for OS/library failure arms (TCP connect/send/ recvmsg, UDP send, FIFO, semaphore, ulog_async ring paths) and deterministic seam tests for race windows (TapStep drop reporting, ThreadedObject lifecycle, MinimalTxRxThread, GenericFIFO wrap/trim) - remove 37 provably-dead guards: assert-after-new/make_unique (operator new throws; never returns null) and the yyjson jsonLen==0 arm (a null result is the only failure mode), plus the AgcStep numSamplesPerRun_ guard (sampleRate_ is ctor-normalized to >= 8000) Branches 1466/1532 (95.7%), Lines 5114/5188 (98.6%), Functions 385/400 (96.2%). Remaining uncovered arms are assert FALSE-side guards (unreachable without -DNDEBUG), deeper socket-failure combinations, and async timing windows that cannot be made deterministic. commit a601fa71ad6d805b6869ce46c75121842a839b1d Author: Mooneer Salem Date: Tue Oct 27 01:36:26 2026 -0700 pipeline: fix latent buffer-overrun and self-move bugs found during coverage work - RADEReceiveStep::execute(): the accumulate loop reserved room for one LPCNET frame per rade_rx() call, but one call can complete several frames from pendingFeatures_ at once. Feeding 10s of modem audio in a single call wrote 17280 shorts into the 16000-sample outputSamples_ buffer (observed SIGABRT: double free or corruption (out)). Now the exact per-call frame bound (pendingFeatures_ + rade_n_features_in_out) is reserved before each call; excess input stays in the FIFO. - AudioPipeline::reloadResampler_(): the keep path re-wrapped the still- live raw pointer into its own unique_ptr slot (unique_ptr self-move), destroying the resampler, leaving a dangling slot, and double-freeing at pipeline teardown (observed SIGSEGV; ASan double-free). The keep path now early-returns and rebuilt resamplers are assigned directly. - ResampleStep: tempInput_/tempOutput_ are RAII members and src_new() runs last, so a throwing new[] (absurd step rate) no longer leaks the libsamplerate state (ASan LeakSanitizer stack via absurdStepRateRejectedAtBothJoinPoints). execute() also caps each chunk's output space at the room left in the one-second output buffer: the linear converter emits ceil(input*ratio) per 10ms chunk, so a 1-second 8000->48000 feed used to write 48100 shorts into a 48000-sample buffer (ASan heap-buffer-overflow). Regression tests: rxSingleExecuteClampsAtOutputCapacity (SIGABRT pre-fix), reloadResamplerKeepPathIsSafe (SIGSEGV pre-fix), linearOneSecondFeedStaysWithinOutputBuffer (48100 > 48000 pre-fix). ASan-verified leak/overflow-free. CI coverage metric after fixes: branches 90.6% (1565/1727), lines 96.6% (5279/5465). commit 33ed36d7ab811dea97f4082315192da267d4a4c7 Author: Mooneer Salem Date: Tue Oct 27 01:02:51 2026 -0700 test: raise branch coverage to 90.3% under the CI llvm-cov metric Adds ~3.2k lines of deterministic unit tests across 21 existing test files (all already registered via BUILD_BACKEND_UNITTESTS + ctest). CI coverage metric: branches 1555/1722 (90.3%), lines 96.6%, 36/36 tests pass under both clang source-based coverage and gcc/gcovr. Notable new coverage: AudioPipeline resampler refresh/result-reload paths, SocketIoClient disconnect/no-connect/nameless-event paths, TcpConnectionHandler socket() failure via RLIMIT_NOFILE, mid-flight IPv6 collection, TLS1.3 HelloRetryRequest stalled-write select outcomes, ThreadedTimer self-stop, GenericFIFO external-buffer lifecycle. Allocation-rejection tests catch std::bad_alloc for clang portability. commit f98ca3c5f21a55905aa877a58cde9fb53dd0cab6 Merge: 681fe2d 9922bba Author: Mooneer Salem Date: Sun Oct 25 18:08:36 2026 -0700 Merge branch 'v2.0-dev' into radev2-dev commit 681fe2d47216ead828455f88d3384b8cbc445c94 Merge: 707f6d1 884503f Author: Mooneer Salem Date: Tue Oct 20 16:33:55 2026 -0700 Merge branch 'main' into radev2-dev commit 884503f9463bd723aeae35dc5bf8ee75896d9406 Author: Mooneer Salem Date: Tue Oct 20 16:33:43 2026 -0700 Use new URL for RNNoise. (#76) commit 2b66b8f22d396b1dfb0b2777c7b09974bccb556c Author: Mooneer Salem Date: Tue Oct 20 16:25:27 2026 -0700 Use new URL for RNNoise. commit 707f6d1b894ade4187da41824e890923dd97f542 Merge: fd404e2 4e59cc3 Author: Mooneer Salem Date: Tue Oct 20 13:15:08 2026 -0700 Merge branch 'main' into radev2-dev commit 4e59cc3cb2691f0e833aab799f860c8b49e26b4e Author: Mooneer Salem Date: Tue Oct 20 13:14:53 2026 -0700 Fix leaks when a connection closes before its onConnect_() runs, or as queued tasks are dropped. (#75) A disconnect can be queued ahead of the onConnect_() for a connection that's just been made, e.g. by SocketIoClient's destructor while the connection is still being made (found by LeakSanitizer in FreeDV's GUI tests, quitting just as FreeDV Reporter connected). onConnect_() then ran for the already closed connection: SocketIoClient started a websocket on it that waited for a read that never came, holding a reference to itself, so it was never freed. onConnect_() is now skipped for a connection that's been closed since it was queued. Also, tasks queued while waitForAllTasksComplete_() is waiting are dropped without running, so they now own what they'd have freed: TcpConnectionHandler::send()'s copy of the data and the event SocketIoClient received. Claude-Session: https://claude.ai/code/session_013G7dQDriDiWypo4B3J83gx Co-authored-by: Claude Opus 5.5 commit d9e7f176a2d96e834dd050e27eae4d56e99218fa Author: Mooneer Salem Date: Tue Oct 20 11:24:52 2026 -0700 Fix leaks when a connection closes before its onConnect_() runs, or as queued tasks are dropped. A disconnect can be queued ahead of the onConnect_() for a connection that's just been made, e.g. by SocketIoClient's destructor while the connection is still being made (found by LeakSanitizer in FreeDV's GUI tests, quitting just as FreeDV Reporter connected). onConnect_() then ran for the already closed connection: SocketIoClient started a websocket on it that waited for a read that never came, holding a reference to itself, so it was never freed. onConnect_() is now skipped for a connection that's been closed since it was queued. Also, tasks queued while waitForAllTasksComplete_() is waiting are dropped without running, so they now own what they'd have freed: TcpConnectionHandler::send()'s copy of the data and the event SocketIoClient received. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013G7dQDriDiWypo4B3J83gx commit fd404e29ce180117ad76c7dc9b718fc14688cd0b Merge: d10b172 98a9d24 Author: Mooneer Salem Date: Sun Oct 18 07:48:40 2026 -0700 Merge branch 'main' into radev2-dev commit 98a9d2458a36225027fb8dd92f4577f9771f0557 Author: Mooneer Salem Date: Sun Oct 18 07:45:32 2026 -0700 Update organization name to freedv. (#74) commit 38b661ebb0145912046671d946a742dd7b16420b Author: Mooneer Salem Date: Sat Oct 17 15:05:21 2026 -0700 Update organization name to freedv. commit d10b17221b71c14face5e8fe1a507729e81de506 Merge: 5ae6116 0aab58b Author: Mooneer Salem Date: Thu Oct 15 10:20:33 2026 -0700 Merge branch 'main' into radev2-dev commit 0aab58b69c458befc1a64f52633ebcb960cd58f1 Author: Mooneer Salem Date: Thu Oct 15 10:20:17 2026 -0700 Resolve LibreSSL/OpenSSL deprecation error in clang-tidy. (#73) * Resolve LibreSSL/OpenSSL deprecation error in clang-tidy. * Fix compiler error. * Fix CMake error. commit 5349a305fbe989c9e3b875959879a6b988707d51 Author: Mooneer Salem Date: Thu Oct 15 09:56:34 2026 -0700 Fix CMake error. commit 50dad5a88c6ff5864f8230e68cf8d4dba9cc86da Author: Mooneer Salem Date: Thu Oct 15 09:46:38 2026 -0700 Fix compiler error. commit b77d4f4beaccf926d2b6aab110053852cbb7c173 Author: Mooneer Salem Date: Thu Oct 15 09:25:50 2026 -0700 Resolve LibreSSL/OpenSSL deprecation error in clang-tidy. commit 5ae6116bb5b999445f019bd54087569f0c20502e Merge: 6053eaa e9d5829 Author: Mooneer Salem Date: Thu Oct 15 00:46:41 2026 -0700 Merge branch 'main' into radev2-dev commit e9d58299926fe438cba5ec5cb5a6870028c718ac Author: Mooneer Salem Date: Mon Oct 12 06:35:57 2026 -0700 TapStep: report dropped samples from the tap thread, not the audio path (#72) execute() logged when the tap's FIFO was full, but it runs on the real-time audio path and logging isn't real-time safe: its first use on a thread allocates memory. RealtimeSanitizer caught this as soon as a loaded machine made the FIFO overflow (freedv-gui's pipeline_TxRxThreadTest on macOS CI). execute() now only counts what it drops, in atomics. The tap thread reports when drops start and, with how many samples were lost, when they stop. Claude-Session: https://claude.ai/code/session_01BpmjFvzRZPSFGZLhgvhqDp Co-authored-by: Claude Opus 5.5 commit bc7aa97e29921a21fed9c84165214fdf28f965d3 Author: Mooneer Salem Date: Mon Oct 12 06:32:24 2026 -0700 TapStep: report dropped samples from the tap thread, not the audio path execute() logged when the tap's FIFO was full, but it runs on the real-time audio path and logging isn't real-time safe: its first use on a thread allocates memory. RealtimeSanitizer caught this as soon as a loaded machine made the FIFO overflow (freedv-gui's pipeline_TxRxThreadTest on macOS CI). execute() now only counts what it drops, in atomics. The tap thread reports when drops start and, with how many samples were lost, when they stop. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BpmjFvzRZPSFGZLhgvhqDp commit 6045b8b02be94e58c4b8bfb791c2afca04c8dac2 Author: Mooneer Salem Date: Sun Oct 11 20:18:23 2026 -0700 TapStep: don't lose buffered audio, and log when samples are dropped (#71) * TapStep: log when samples are dropped TapStep hands audio to its own thread through a FIFO holding a quarter of a second. When that thread falls behind, whatever doesn't fit is dropped so as not to hold up the audio path, but until now nothing said so, which left e.g. a recording missing audio with no indication why. Warn when drops begin and report how much was lost once they end (or the step is destroyed), as RecordStep in freedv-gui does for its own FIFO. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BpmjFvzRZPSFGZLhgvhqDp * TapStep: wake the tap thread per block and hand over what's left when destroyed The tap thread was only woken once more than 100ms was buffered, and whatever was buffered when TapStep was destroyed was thrown away. So: * Up to 100ms (plus whatever the thread hadn't got to yet) was missing from the end of anything produced by a tap, e.g. a recording. * Only 150ms of the 250ms buffer was left for audio arriving before the thread actually got to run, which is what there is to absorb audio arriving in a burst or the thread being held up. Wake the thread whenever there's a whole block for it, and have it process the blocks still buffered before it exits. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BpmjFvzRZPSFGZLhgvhqDp --------- Co-authored-by: Claude Opus 5.5 commit f432f751d7f0f962de1a268b3a866b2ef7bba55e Author: Mooneer Salem Date: Sun Oct 11 18:03:35 2026 -0700 TapStep: wake the tap thread per block and hand over what's left when destroyed The tap thread was only woken once more than 100ms was buffered, and whatever was buffered when TapStep was destroyed was thrown away. So: * Up to 100ms (plus whatever the thread hadn't got to yet) was missing from the end of anything produced by a tap, e.g. a recording. * Only 150ms of the 250ms buffer was left for audio arriving before the thread actually got to run, which is what there is to absorb audio arriving in a burst or the thread being held up. Wake the thread whenever there's a whole block for it, and have it process the blocks still buffered before it exits. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BpmjFvzRZPSFGZLhgvhqDp commit 471e20fe867ee09d945db5e17b7833f17c208d52 Author: Mooneer Salem Date: Sun Oct 11 17:40:00 2026 -0700 TapStep: log when samples are dropped TapStep hands audio to its own thread through a FIFO holding a quarter of a second. When that thread falls behind, whatever doesn't fit is dropped so as not to hold up the audio path, but until now nothing said so, which left e.g. a recording missing audio with no indication why. Warn when drops begin and report how much was lost once they end (or the step is destroyed), as RecordStep in freedv-gui does for its own FIFO. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BpmjFvzRZPSFGZLhgvhqDp commit c803f4ce6bbf7697c796875422389ec33bac3085 Author: Mooneer Salem Date: Sat Oct 10 00:29:00 2026 -0700 Fix AGC tests after merging main; don't dilute loudness history on reset. main's new tests assumed main's AGC. On this branch the AGC cuts at most 12 dB, moves 1 dB/s, measures short-term (3 s) loudness and deliberately keeps its gain across reset(). - AgcStep::reset(): drop the "feed 400 ms of silence" step that came in with the merge. It was written to clear the 400 ms momentary window; with the 3 s short-term window it clears nothing and only dilutes the measurement. The comment now says the gain and loudness history survive a reset on purpose. - AgcStepTest: the gain-limit test expects 12 dB (was 20), runs 20 s for the 1 dB/s ramp and disables the limiter, which at -4 dB pulls a square wave down further. - AgcStepTest: findAmplitudeForLoudness() adjusted the level once more after reaching the target, returning a tone up to ~3.7 dB too quiet (-26.8 LUFS when asked for -23 at 48 kHz). It now stops on target. - PipelineResetTest: the AGC "reset matches a fresh step" cases are replaced by one for what reset() still guarantees here (buffered input is discarded), and the whole-pipeline case uses a level adjust step instead of the AGC. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 9b625b3f7a994f42284718dc931a149c157338e4 Merge: 4f59262 f1976cf Author: Mooneer Salem Date: Fri Oct 9 23:51:39 2026 -0700 Merge branch 'main' into ms-agc-tweaks commit 6053eaab16e5e376280db209eb4c1001a83689bf Author: Mooneer Salem Date: Fri Oct 9 23:07:39 2026 -0700 Fix the Windows build and test run after merging main. main's CI now cross-compiles the tests for Windows and runs them there: - RadeTextSim and RadeTextOtaSim used M_PI, which Windows' C library doesn't define; add the usual fallback. - The Windows job ran every .exe in the build, which now includes those simulations (not tests: they print CSV or need arguments). It now collects only the programs ctest registers. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit a88ff88815c0377b33f100232ff0308e17ce50bd Merge: 096a142 f1976cf Author: Mooneer Salem Date: Fri Oct 9 22:54:56 2026 -0700 Merge branch 'main' into radev2-dev Brings in the reporting/networking/pipeline unit tests (#70). Tests from main that exercise the RADE modem now use RADE V2: - RadeStepResetTest, RadeLoopbackTest and MinimalTxRxThreadOversTest open RADE with RADE_MODE_V2. - MinimalTxRxThreadOversTest uses the V2 text interface (the callsign is streamed throughout a transmission rather than sent in the end-of-over), so each transmission is 15 s (a cold-start receiver needs about 9-12 s for its first decode) and is received separately, checking that each delivers the callsign. - RadeTextUnitTest: main's V1 on-air format, CRC, character and length tests are replaced by V2 equivalents (tests 20-23) built on a reference encoder for the V2 block layout (base-38 characters, framing bits, block CRC). The undefined-character-code test is dropped: V2's 38-symbol alphabet has no undefined codes, and over-long callsigns are covered by the existing multi-block test. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit f1976cf0ba68a52bec7b0a1e54b3e861baebac89 Author: Mooneer Salem Date: Fri Oct 9 22:32:14 2026 -0700 Add unit tests for the reporting module (#70) * Add unit tests for the reporting module Adds hermetic unit tests for CsvReporter, UdpReporter, PskReporter and FreeDVReporter (22 tests total), registered via DefineUnitTest under BUILD_BACKEND_UNITTESTS and runnable with: ctest -R reporting_ - CsvReporterTest: header written exactly once, record field/format correctness, unopenable path is a silent no-op. - UdpReporterTest: fdv_callsign JSON schema validated over a real loopback socket; non-record methods emit nothing; record frequency follows the addReceiveRecord argument. - PskReporterTest: SenderRecord wire layout (incl. >32-bit frequency), 4-byte payload padding, 0x99 0x92 / 0x99 0x93 record headers, reportCommon_ record drain, auto-flush threshold boundary. - FreeDVReporterTest: isValidForReporting gating, all event handlers dispatched directly with strict JSON type validation, bulk_update tolerance of malformed entries, pre-connect state save and connection_successful replay gate, analog-mode hide/show. Production changes required by the tests: - pskreporter.h: include (it declares std::vector members but only compiled because every .cpp included first). - pskreporter.h / FreeDVReporter.h: friend hooks granting the tests access to private encoding helpers / event handlers so no live server is needed. * reporting: drop unused git_version link dependency. fdv_reporting doesn't reference any git_version symbols, and the git_version target only exists when built inside freedv-gui. The new reporting unit tests are the first standalone executables to link fdv_reporting, so standalone builds failed with 'cannot find -lgit_version'. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * TcpConnectionHandler: dispatch TLS data that ends on a read-size boundary. When the bytes available over TLS were an exact multiple of READ_SIZE_BYTES, the final SSL_read() returned SSL_ERROR_WANT_READ and the goto skipped the dispatch of everything already read on that pass. The data sat in receiveBuffer_ until more arrived (for FreeDV Reporter, potentially until the next engine.io ping). Break out to dispatch instead when data was read. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * TcpConnectionHandler: serialize SSL_read()/SSL_write() across threads. SSL_write() runs on the ThreadedObject worker while SSL_read() runs on receiveThread_, both against the same SSL object with no locking, which OpenSSL/LibreSSL don't support. Under TLS 1.3 this randomly lost data in either direction (e.g. while session tickets were being processed). Route both calls (and their SSL_get_error()) through helpers holding sslMutex_, which is never held across select(). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * TcpConnectionHandler: don't drop IPv4 DNS results that complete late. If IPv6 resolution finished with no results and IPv4 resolution finished between the 'collect completed results' check and the 'wait for IPv4' check, the latter saw ipv4Complete_ == true and skipped collecting the IPv4 result, leaving no addresses to try and forcing a 5 s reconnect. Decide based on whether the IPv4 future has been consumed instead. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * Add TcpConnectionHandler and end-to-end FreeDVReporter tests. TcpConnectionHandlerTest (13 tests) exercises TcpConnectionHandler against an in-process loopback server: connect/send/receive incl. multi-chunk transfers, server and client disconnects, refused connections, reconnect timer, localhost IPv6->IPv4 fallback, unresolvable hosts, and (with TLS enabled) a verified TLS round trip using a runtime-generated self-signed certificate, untrusted certificates, non-TLS replies and cancelling a stalled handshake. FreeDVReporterTrafficTest (8 tests) drives a real FreeDVReporter against an in-process fake FreeDV Reporter server speaking WebSocket/engine.io/socket.io: auth payload and roles, state replay on connection_successful, all inbound events incl. bulk_update and malformed packets, all outbound reports, ping/pong, ping timeout, server-initiated disconnects, and reconnect while hidden. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * PskReporter: don't let background sends outlive the reporter. send() ran reportCommon_() on a detached thread capturing 'this', so destroying the reporter right after a send (e.g. when PSK Reporter is turned off just after the 50-record auto-flush) let that thread use the freed object and its mutex, and the destructor could report the same records a second time. Keep the send thread joinable, join it before starting another and on destruction, and release recordListMutex_ before addReceiveRecord() calls send() so that join can't deadlock. Also make the server address a member (defaulting to the same defines) so tests can point reports at loopback, and free the getaddrinfo() result on the socket()/sendto() error paths. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * Add PSK Reporter flush, UDP multicast and TLS handshake timeout tests. PskReporterTest: send reports to a loopback UDP socket instead of the live report.pskreporter.info (test 5 previously sent a real report on every run), and cover the 50-record auto-flush, destroying the reporter while a flush is in flight, and the destructor flushing unsent records. UdpHandlerTest (new, 5 tests): unicast IPv4/IPv6 sends, IPv4 and IPv6 multicast destinations (as UdpReporter uses), binding to a multicast group, and unparseable/non-local addresses. Multicast delivery checks are skipped when the host doesn't loop multicast back. TcpConnectionHandlerTest: a stalled TLS handshake gives up after the 10 s TLS_HANDSHAKE_TIMEOUT without a disconnect() call. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * AgcStep: clear WebRTC limiter and loudness history on reset(). reset() zeroed the AGC's own gain variables but left the WebRTC limiter state and libebur128's 400 ms momentary-loudness window untouched. freedv-gui resets the TX pipeline on every RX->TX transition, so each transmission started with gain decisions based on the tail of the previous one: after a reset nearly every sample of the following second differed from a fresh AgcStep (by up to ~860 on a ~1000-amplitude test signal). Re-initialize the WebRTC limiter (no allocation) and, since libebur128 has no reset and recreating its state allocates on the real-time thread, feed it 400 ms of silence, which leaves it equivalent to a fresh state. Output after reset() is now bit-identical to a new AgcStep. Costs ~0.2 ms per reset at 48 kHz in a Debug build. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * Add PipelineResetTest: reset() must match a freshly constructed step. For ResampleStep (up/down), AgcStep (8 and 48 kHz), RNNoiseStep, BandwidthExpandStep, EitherOrStep (both branches) and a full AudioPipeline with inserted and result resamplers: a step that has processed loud audio and then been reset must produce bit-identical output to a new step fed the same quieter input. On failure it reports how many samples differ, where, and by how much. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * LinkStep: never return more than one second of audio per call. OutputStep's buffer holds one second at the link's sample rate, but the FIFO holds 48000 samples by default whatever the rate. A drain-all call (numInputSamples == 0, e.g. when a resampler ahead of it in freedv-gui's TX monitor pipeline produces no samples) or an oversized request with more than a second buffered wrote past the end of the buffer. Cap each read at the buffer size; the rest is returned by later calls. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * ToneInterfererStep: clip instead of wrapping when adding the tone. The tone was added to each short sample with '+=', so loud input plus the tone wrapped around to the opposite sign (30000 + 5000 -> -30536), turning a slight overload into a full-scale click. Sum in int and clamp to the short range. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * ulog: always NUL-terminate ulog_event_to_cstr() output. fmemopen() doesn't guarantee a terminator when the output fills the buffer (macOS leaves none), so a truncated message came back as an unterminated string. Terminate the last byte, and reject a zero-size buffer. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * Add tests for remaining pipeline steps, RADE reset, spin mutex and ulog config. - LinkStepTest: round trip, partial and drain-all reads, output bounded to one second, whole-block drop when full, clearFifo(), null/empty input. - MuteStepTest: silence at same/up/down/odd rates, empty input, full second. - ToneInterfererTest: tone level and phase continuity across blocks, adding to input, clipping at full scale, empty blocks. - RadeStepResetTest: reset() discards buffered TX/RX input (bit-identical to a fresh step on fresh RADE state), partially collected TX features and queued EOO samples; RX accessors. Each assertion was checked to fail with the corresponding line removed from reset(). - AudioSpinMutexTest: try_lock/unlock semantics, mutual exclusion under contention, blocking in lock(), and lock hand-off latency. - UlogConfigTest: level strings, set_level, set_quiet, set_lock, set_prefix_fn and ulog_event_to_cstr() incl. truncation. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * TcpConnectionHandler: pick the first address list by results, not flags. Fixes an intermittent segfault in connectImpl_() seen on the Linux ARM CI runner (FreeDVReporterTrafficTest), a regression from 8894e13. That commit made the 'IPv6 empty, wait for IPv4' path collect the IPv4 result with ipv4ResultFuture.get() instead of polling ipv4Complete_. The resolver threads publish their result before setting ipv4Complete_, so get() can return while the flag still reads false; the following 'which list first' check then required ipv4Complete_, left whichIndex pointing at the empty IPv6 list, and socket() dereferenced a null addrinfo. On Linux, resolving an IPv4 literal as IPv6 fails immediately, so every loopback connection took this path. Choose the starting list from the collected results (a non-null list has necessarily been collected), and make the connect loop step to the non-empty list if it's ever pointed at an empty one. Reproduced on a Raspberry Pi 4 (Debian 13, GCC 14) running the test under gdb, 4 in parallel: 2 crashes in the first 8 runs before, none in 200 runs after. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * Tests: ignore SIGPIPE in socket test programs. The fake servers in TcpConnectionHandlerTest and FreeDVReporterTrafficTest write to clients that may already have hung up; e.g. in the untrusted- certificate test the client closes the connection after rejecting the cert while the server's SSL_accept() is still writing. With LibreSSL on Linux that write raised SIGPIPE and killed the test. Ignore SIGPIPE so it surfaces as a failed write instead. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * ThreadedObject (Linux): don't report idle while a task is starting. eventLoop_() dequeued a task under eventQueueMutex_ but only set taskCurrentlyExecuting_ after releasing it, so waitForAllTasksComplete_() could see an empty queue and nothing running in between, return, and let the object be destroyed under the task. waitForAllTasksComplete_() also gave up after ~250 ms, letting a destructor proceed while a longer task was still running. Set and clear the flag under the queue lock, read both under it, and wait without a timeout like the macOS implementation (logging if it takes over 2 s). A task waiting on its own object returns instead of waiting on itself. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * ThreadedTimer: fix callback lifetime races; use one implementation everywhere. The timer server used on Linux and Windows had three races: - It read a timer's fire time after releasing its lock, so a timer stopped and destroyed in that window was used after free. - stop() didn't wait for a callback that was already running, so destroying a timer could free its callback (and whatever it uses) mid-call. - A repeating timer stopped while being rescheduled was put back on the queue after stop(), leaving a dangling pointer once it was destroyed. All scheduling state now lives under the server mutex, a repeating timer is rescheduled before (not after) its callback runs, and stop()/the destructor wait for a running callback unless called from that callback. The macOS GCD-based implementation had the same class of bug: a handler already dispatched could still run after stop() returned (calling a stopped or destroyed timer's callback -- seen as std::bad_function_call aborts under load), and a callback calling stop()/restart() on its own timer deadlocked on timerMutex_. Rather than maintain a second, macOS-only fix, macOS now uses the same timer server, with its thread at utility QoS as the GCD queue was. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * Add ThreadedObject tests and ThreadedTimer lifetime/race tests. ThreadedObjectTest: task ordering, a destructor waiting for a task longer than 250 ms, no task running after destruction over 300 create/enqueue/ destroy cycles with a concurrent producer, and (Linux) waiting from the object's own task. ThreadedTimerTest: a stopped timer really stops, stop() waits for a running callback, destroying a timer just after its callback starts, a repeating timer stopped just after firing never resurrects, stop()/restart() from inside the callback, and concurrent create/start/destroy from four threads. Against the previous Linux implementation (Raspberry Pi 4) both programs failed every run (ThreadedObjectTest at the 250 ms case, ThreadedTimerTest with a segfault from a callback on a destroyed timer); against the previous macOS implementation ThreadedTimerTest failed ~1 in 8 runs under load. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * Add TLS partial read/write tests; fix TLS write error message. TcpConnectionHandlerTest: - 15: an 8 MB TLS send to a server that isn't reading yet (SSL_write() returns SSL_ERROR_WANT_WRITE repeatedly) completes intact once it reads. - 16: disconnect() abandons a send blocked on a full buffer, plain and TLS. - 17: the server resetting the connection mid-send makes SSL_write() fail and the client disconnect, rather than hang. - 18: a corrupted TLS record from the server makes SSL_read() fail and the client disconnect, delivering nothing. - 19: a TLS 1.3 key update while the client's send is stalled; data stays intact and the connection keeps working under the new keys. - 20: TLS 1.2 renegotiation while the client's send is stalled: the stalled SSL_write() has to wait for the server's half of the new handshake (SSL_ERROR_WANT_READ). Reports SKIP if the TLS library won't renegotiate. Also correct the write path's error log, which said 'Unable to read'. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * TcpConnectionHandler: don't hang disconnect while SSL_read() waits to write. When SSL_read() returned SSL_ERROR_WANT_WRITE (e.g. a TLS 1.2 renegotiation arriving while the socket's send buffer is full), the receive thread waited for writability with no timeout. disconnect() joins that thread, so it hung for as long as the peer stopped reading. Wait in SELECT_SLICE_US slices instead, so the loop notices ssl_ being cleared. Adds TcpConnectionHandlerTest Test 21, which reproduces the hang (verified to fail with the old untimed select()), and SemaphoreTest. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * TcpConnectionHandlerTest: make Test 21 wait for SSL_read() to want a write. Under parallel load the fixed 500 ms sleep could elapse before the client processed the HelloRequest, so the test passed without reaching the SSL_ERROR_WANT_WRITE path. Wait (under sslMutex_, via a test-only friend hook) until the client's SSL object reports SSL_want_write(), and SKIP if the client refuses to renegotiate. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * TcpConnectionHandlerTest: make Test 21 deterministic on Linux and LibreSSL. Test 21 relied on a full kernel send buffer to make the client's SSL_read() return SSL_ERROR_WANT_WRITE. How much room the kernel frees afterwards (buffer auto-tuning, ACKs piggybacked on the server's HelloRequest) differs by OS, so on Linux the ClientHello went out and the test failed; on macOS it could pass without reaching the branch. Now the test fails the client's TLS writes at the BIO level (a write callback on its socket BIO, so no BIO ownership changes, which differ between OpenSSL and LibreSSL), has the server request renegotiation without blocking for the reply, waits for SSL_want_write(), and only then fills the socket buffer until it stays full so the receive thread really waits for writability. Verified on macOS (OpenSSL 3) and Linux ARM (LibreSSL): passes under 4x parallel load, and fails with the old untimed select(). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * ulog_async: render h/hh and unsupported conversions like printf. - %hhd/%hd/%hhu/%hu printed the full int argument (e.g. %hhd of 300 printed "300" where printf prints "44"): the length modifier is dropped when the conversion is rebuilt with "ll", so narrow the value when it is captured instead. - An unsupported %*d, %.*f or positional %1$d left the rest of the conversion in the output ("d"); skip the whole conversion. UlogAsyncTest gains tests comparing every supported conversion with snprintf(), unsupported conversions, argument/message/flag overflow, and start/stop/flush edge cases (ulog_async.cpp line coverage 77.5% -> 97.9%). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * TcpConnectionHandlerTest: add plain-TCP reset and stalled-renegotiation send tests. - Test 22: the server resets the connection during a plain-TCP send that can't complete; write() must fail and the client disconnect. - Test 23: the server resets an idle plain-TCP connection; read() fails (rather than EOF) and the client disconnects. - Test 24: a TLS 1.2 renegotiation the server never completes leaves SSL_write() waiting to read; disconnect() must abandon the send (verified to fail without the cancel check in that wait). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * TcpConnectionHandler: don't drop received data; ignore connect() while connected. - Received data was silently dropped when the 128 KB receive buffer was full (the write's result was ignored): a 1 MB burst to a busy receiver delivered only ~128 KB, which would corrupt a WebSocket stream. The receive thread now stops reading until the handler catches up, so the data waits in the socket and TCP flow control slows the sender. With TLS, data SSL has already decrypted is read without waiting on select(). - connect() (or a queued reconnect attempt) on a live connection redid setup on the live socket and replaced the running receive thread, calling std::terminate(). It's now ignored with a warning, and the connection parameters are only changed on the worker thread while disconnected (the receive thread reads usingTLS_). Tests 25/25b (1 MB burst to a slow receiver, plain and TLS) and 26 (connect() while connected) fail against the previous implementation. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * TapTest: test the tap thread, overflow policy and destruction. The old test fed one sample, so the tap thread never ran, and its only check of the tapped data couldn't pass (the tap runs on a copy) and was non-fatal. Now: audio passes through untouched; the tapped step gets the same audio in order in 10 ms blocks; a tap that falls behind loses whole blocks without stalling execute(); destruction joins the thread and frees the tapped step. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * CI: add a macOS job built with static LibreSSL. freedv-gui's macOS release build uses USE_STATIC_LIBRESSL=1, but every CI job here used OpenSSL, so the shipping TLS library was never tested. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * Make the unit tests build for Windows. - TestSocketCompat.h: one set of socket helpers (open/close, waiting for readability, setsockopt, timeouts, non-blocking mode) plus setenv and temp files, mapping to Winsock (initialized before main()) on Windows. Socket handles stay in ints: Winsock handles fit and INVALID_SOCKET becomes -1. It also undoes wincrypt.h's macros that clash with OpenSSL/LibreSSL headers. - LoopbackTcpServer, TcpConnectionHandlerTest, UdpHandlerTest, UdpReporterTest, PskReporterTest and UlogConfigTest use it (or, for UlogConfigTest, the same stderr capture as UlogAsyncTest). - TcpConnectionHandlerTest Test 21 gets the client's socket from the handler (via the test friend hook) instead of scanning fds, which can't work with Winsock handles. - SIGPIPE handling is POSIX-only; M_PI gets a fallback definition. - MinimalTxRxThreadTest is skipped when cross-compiling: it runs Python on the build host. All 29 tests cross-compile with llvm-mingw (with static LibreSSL, as freedv-gui's Windows build uses) and still pass on macOS. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * CI: run the unit tests on Windows. The Windows build moves out of the matrix into its own job, which cross-compiles with llvm-mingw as before but with the unit tests, and uploads them with the DLLs they need. A windows-latest job then runs each test (10-minute limit each) and fails if any fails or hangs. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * Fix Windows-only bugs found by running the unit tests on Windows. - TcpConnectionHandler: a failed connect (e.g. refused) was never detected on Windows, which reports it in select()'s exception set, not the write set, so the attempt hung until disconnect() and a configured reconnect never happened. Also treat a non-zero SO_ERROR as a failure. - TcpConnectionHandler: honor SSL_CERT_FILE/SSL_CERT_DIR on Windows too, in addition to the Windows root store, as on other platforms. - CsvReporter: on Windows, tellp() right after opening in append mode is 0 even for a non-empty file, so every session appended another header line. Seek to the end before checking. - ulog_event_to_cstr(): the Windows fmemopen() replacement is backed by a temporary file and never writes into the buffer, so the result was whatever the buffer held before. Copy it out before closing. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * Adjust tests for Windows. - Winsock reports a recv() timeout via WSAGetLastError(), not errno. - %Lf isn't compared with snprintf(): Windows' C library treats long double as double, unlike clang/mingw's 80-bit long double. - Windows loopback buffers well over 8 MB, so sends meant to stall on a peer that isn't reading use 64 MB there. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * TcpConnectionHandler: stop the receive thread after EOF or a read error. It queued a disconnect and went straight back to reading, so until the worker thread ran the disconnect (which can wait behind a long send) it spun, logging the same error and queueing more disconnects: 128 identical "read failed" lines in one second on Windows, and duplicate "EOF received" lines elsewhere. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * TcpConnectionHandlerTest: pin small socket buffers for plain stalled sends. Windows accepted an entire 64 MB send on loopback while the peer wasn't reading, so Tests 16 (plain) and 22 never stalled. Give the client's send buffer and the server's receive buffer small fixed sizes instead. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * TcpConnectionHandlerTest: stall plain sends with a second send. Pinning buffer sizes didn't help: Winsock accepts any single send in full while the data it has queued is under SO_SNDBUF, so on Windows only a second send behind it stalls. Tests 16 (plain) and 22 now send twice and check the second. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * TcpConnectionHandlerTest: keep sending until a plain send stalls. Two 64 MB sends still completed on Windows loopback with no reader, so send until one is still pending after 300 ms (up to ~1 GB). On Linux and macOS the first send stalls, as before. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * CI: add a coverage job that posts a summary on the run's page. Builds with clang source-based coverage on Linux, runs the tests and writes per-file line/function/branch coverage to the job summary; the line-by-line HTML report is uploaded as the coverage-html artifact. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * CI: link libatomic in the clang coverage build. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * Link libatomic when std::atomic needs it. Unoptimized clang builds against libstdc++ leave std::atomic::is_lock_free() as a call to libatomic's __atomic_is_lock_free, so RadeTextTest (and anything else linking RADEReceiveStep) failed to link. fdv_util now checks whether atomics link on their own and adds libatomic if they need it, which reaches every backend library and downstream projects. Drops the CI-only workaround from the coverage job. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * TcpConnectionHandler: don't let a slow DNS lookup hold up connecting. After an attempt to one address, the connect loop waited for the other address family's DNS lookup to finish before trying anything else, and once it ran out of addresses it waited for all lookups without checking the attempts already in flight. A slow or hanging AAAA lookup (common with broken IPv6 DNS) therefore delayed the IPv4 connection by the whole lookup time. Only collect lookups that have finished, and keep checking in-flight attempts while waiting for the rest. Tests for the Happy Eyeballs logic, with DNS answers scripted through a now-virtual resolveAddresses_(): IPv6 preferred when both resolve, a short wait for a slightly later IPv6 answer, slow IPv6 DNS not delaying IPv4 (single address and fallback to a second one), refused IPv6 falling back to IPv4, waiting for IPv4 when IPv6 returns nothing, no addresses at all, an unanswered address not blocking the next, and disconnect() during DNS. LoopbackTcpServer can now listen on ::1. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * FreeDVReporter: don't crash on a tx_report without a string last_tx. A missing or non-string last_tx built a std::string from a null pointer. Treat it like null (never transmitted). Tests now check every field of every server event missing, wrongly typed and null; payloads that aren't objects; events with no handler registered; and the remaining isValidForReporting() gates. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * RadeTextUnitTest: test the on-air format, CRC rejection and character set. A reference framer builds frames independently of rade_text, so tests can pin the on-air format, check that a cleanly decoded frame with a wrong CRC is dropped (single bit errors were always corrected by LDPC before reaching the CRC check), and that undefined 6-bit codes and unencodable characters are skipped. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * AgcStep: size the output buffer for the rate it actually runs at. An unsupported sample rate (e.g. 44100) falls back to 48 kHz, but the output buffer was sized from the requested rate, so a large block of 48 kHz audio overran it. Tests for that fallback and for the 20 dB maximum cut (the 12 dB maximum boost can't be reached: the silence gate caps the boost at 10 dB). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * AudioPipelineTest: test resampling between steps. Multi-step pipelines with steps at different rates and a step that changes rate: each step must get audio at its own rate, the end resampler must follow the last step, and the tone must come out intact. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * ulog_async: render an argument that didn't fit as . The first argument that didn't fit in a record rendered as nothing, while every conversion after it rendered as . Tests for each argument type running out, a conversion cut off by the render buffer, and the %i/%F/%E/%G/%A conversions. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * EventHandler: give every handler the arguments intact. operator() forwarded its arguments to each handler in turn, so with a by-value movable argument (e.g. std::string) the first handler moved it out and the rest got an empty one. Pass them as lvalues instead. No current freedv-gui use is affected (they take pointers, numbers or const references). New EventHandlerTest covers +=, =, clear() and this. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * CsvReporter: quote fields containing a comma, quote or line break. RADE text's character set includes ',', so a callsign received over the air could add a column to the log. Fields are now quoted per RFC 4180. The test files also move from the working directory to the temporary directory. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * ResampleTest: check the output of 44.1 kHz conversions. The existing tests covered only 8 <-> 48 kHz and only checked that about the right number of samples came out (they pass with a 2% ratio error). New tests stream 44.1 <-> 48 kHz and 44.1 <-> 8 kHz in 10 ms blocks and check the sample count (no drift), frequency and level of a tone. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * LevelAdjustTest: gain past full scale clips rather than wrapping. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * FreeDVReporterTrafficTest: test the secure (TLS) connection. freedv-gui connects to FreeDV Reporter over TLS by default, but only the plain connection was tested end to end. The fake server can now serve over TLS, and new tests run the handshake and events (including one spanning several TLS records) over it, and check that a server whose certificate isn't trusted is refused. The runtime-generated test certificate moves to a shared header. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * Give every unit test a 10-minute timeout; pin the radae scripts. Without a timeout a hung test ran until the CI job's 6-hour limit. MinimalTxRxThreadTest keeps its 1 hour. Its radae download (used only for loss.py) is pinned to a commit instead of tracking main, and is now a declared dependency of the test. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * os: test the GUI-free parts; fix Linux thread names and repeated activity starts. New OsInterfaceTest covers the OS name sent to FreeDV Reporter, thread naming (read back from the OS), the low-latency activity and, off macOS, the microphone check. - Linux: names longer than 15 characters were rejected by pthread_setname_np (ERANGE), so freedv-gui's SerialController, RigPttDisconnect and RigFreqDisconnect threads were left unnamed. They're now shortened to 15 characters. - macOS: calling StartLowLatencyActivity() twice leaked the first activity, and its idle-sleep assertion, until the process exited. It now ends any existing activity first. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * BandwidthExpandStep: handle blocks larger than its input buffer. The input FIFO holds half a second (8000 samples). A larger block was written in one go, which the FIFO rejected outright, while the output count had already been set from it: the caller got up to three times the input's length of stale buffer contents instead of audio. Feed the FIFO in pieces that fit, processing whole frames as they become available. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * Functional tests for BandwidthExpandStep, RNNoiseStep, EitherOrStep and RADE. - BandwidthExpandStepTest: output in whole 20 ms frames at 3x the input rate, the speech band passing at its original level, content added above 8 kHz (compared with plain resampling), and a block larger than the input buffer giving the same audio as small blocks. - RNNoiseStepTest: the first 10 ms frame held back as latency, block size not changing the output, and steady noise suppressed (about -42 dB) while real speech is kept (within 1 dB). - EitherOrTest: switching branches between calls, each block going only to the selected step. - RadeLoopbackTest: real speech through RADE TX and straight into RX syncs at a high SNR and comes out at the input's level; noise alone never syncs or produces audio; once sync is lost the SNR stops changing. Runs without Python, so also on Windows. Real speech comes from the RADE sources the build already fetches (rade_src/wav/all.wav, see test/SpeechSample.h); the Windows job ships a copy next to the tests. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * MinimalTxRxThreadTest: run without Python; make its checks able to fail. The test was only built where Python with torch was found, so the TX/RX thread orchestration never ran on Windows. Python is only needed for radae's loss.py score, so the test is now always built and skips that score without it (using the first 10 s of speech to keep the run short: about a minute for all 42 rate combinations on macOS). - The callsign check started out true, so it passed even if the EOO callsign never arrived. It now starts false. - Received speech was read and discarded. It's now kept and checked for length (about what was sent) and level (within 6 dB), so there's a quality check without Python too. - Temp files and the speech sample (test/SpeechSample.h) are portable. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * RadeTextUnitTest: over-long callsigns are cut to 8 characters, empty ones arrive empty. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * TcpConnectionHandlerTest: connect over IPv6 when it answers after every IPv4 address failed. Covers the wait-for-pending-DNS path in connectImpl_(), which no test reached on Linux: the only IPv4 address refuses, the handler runs out of addresses while the IPv6 lookup is pending, and must then try the IPv6 answer when it arrives. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * MinimalTxRxThreadOversTest: a second transmission starts clean. Two transmissions in a row through the TX and RX threads, with 0.8 s of loud tone reaching the TX input while not transmitting. Starting TX again must reset the pipeline and empty the input FIFO, so the second transmission is the same length as the first (removing the FIFO clear makes it 0.8 s longer), and each must end with its own end-of-over: the receiver gets the callsign twice. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * MinimalTxRxThreadOversTest: queue each transmission's speech at once. On a busy CI runner (macOS universal job) the test's feeding loop fell behind, the TX thread ran dry and sent silence (as it should), and the second transmission came out longer. The input FIFO now holds a whole transmission, so underruns can't happen and only stale audio that wasn't cleared could add length. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * MinimalTxRxThreadOversTest: bound how much silence the TX thread can send. With nothing queued, the TX thread transmits silence for as long as its output FIFO has room. While the test waited between starting TX and writing the speech, that added a scheduling-dependent amount of silence (0.6 s on the Windows runner), so the two transmissions' lengths differed for reasons unrelated to the FIFO wipe. The output FIFO now holds exactly one modem frame and isn't drained during that wait, so the thread stops after one block. Both transmissions come out the same length even with a 500 ms delay before feeding, and removing the FIFO wipe still makes the second 0.84 s longer. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 --------- Co-authored-by: Claude Opus 5.5 commit ae1052107710dd98c522d3af9f5a7cd21ee39591 Author: Mooneer Salem Date: Fri Oct 9 22:03:58 2026 -0700 MinimalTxRxThreadOversTest: bound how much silence the TX thread can send. With nothing queued, the TX thread transmits silence for as long as its output FIFO has room. While the test waited between starting TX and writing the speech, that added a scheduling-dependent amount of silence (0.6 s on the Windows runner), so the two transmissions' lengths differed for reasons unrelated to the FIFO wipe. The output FIFO now holds exactly one modem frame and isn't drained during that wait, so the thread stops after one block. Both transmissions come out the same length even with a 500 ms delay before feeding, and removing the FIFO wipe still makes the second 0.84 s longer. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit c60849e9db840c54fd0ef16135c39dfdd9d66a04 Author: Mooneer Salem Date: Fri Oct 9 21:35:59 2026 -0700 MinimalTxRxThreadOversTest: queue each transmission's speech at once. On a busy CI runner (macOS universal job) the test's feeding loop fell behind, the TX thread ran dry and sent silence (as it should), and the second transmission came out longer. The input FIFO now holds a whole transmission, so underruns can't happen and only stale audio that wasn't cleared could add length. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit fa5778efe41b0f7fc581aa7b3af464c52752a003 Author: Mooneer Salem Date: Fri Oct 9 21:11:25 2026 -0700 MinimalTxRxThreadOversTest: a second transmission starts clean. Two transmissions in a row through the TX and RX threads, with 0.8 s of loud tone reaching the TX input while not transmitting. Starting TX again must reset the pipeline and empty the input FIFO, so the second transmission is the same length as the first (removing the FIFO clear makes it 0.8 s longer), and each must end with its own end-of-over: the receiver gets the callsign twice. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 10808857f1c09de7a8ae932d5f306933dee65f29 Author: Mooneer Salem Date: Fri Oct 9 20:19:40 2026 -0700 TcpConnectionHandlerTest: connect over IPv6 when it answers after every IPv4 address failed. Covers the wait-for-pending-DNS path in connectImpl_(), which no test reached on Linux: the only IPv4 address refuses, the handler runs out of addresses while the IPv6 lookup is pending, and must then try the IPv6 answer when it arrives. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 17cdfde0e021a124978bdefaaa301d41a8f2f14b Author: Mooneer Salem Date: Fri Oct 9 18:33:34 2026 -0700 RadeTextUnitTest: over-long callsigns are cut to 8 characters, empty ones arrive empty. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 0a21b5107f9c71cf0532e551ed4a01130ded7666 Author: Mooneer Salem Date: Fri Oct 9 18:33:34 2026 -0700 MinimalTxRxThreadTest: run without Python; make its checks able to fail. The test was only built where Python with torch was found, so the TX/RX thread orchestration never ran on Windows. Python is only needed for radae's loss.py score, so the test is now always built and skips that score without it (using the first 10 s of speech to keep the run short: about a minute for all 42 rate combinations on macOS). - The callsign check started out true, so it passed even if the EOO callsign never arrived. It now starts false. - Received speech was read and discarded. It's now kept and checked for length (about what was sent) and level (within 6 dB), so there's a quality check without Python too. - Temp files and the speech sample (test/SpeechSample.h) are portable. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 9bdef4fe57481d4809ff828e7c7fc864a494d512 Author: Mooneer Salem Date: Fri Oct 9 17:55:55 2026 -0700 Functional tests for BandwidthExpandStep, RNNoiseStep, EitherOrStep and RADE. - BandwidthExpandStepTest: output in whole 20 ms frames at 3x the input rate, the speech band passing at its original level, content added above 8 kHz (compared with plain resampling), and a block larger than the input buffer giving the same audio as small blocks. - RNNoiseStepTest: the first 10 ms frame held back as latency, block size not changing the output, and steady noise suppressed (about -42 dB) while real speech is kept (within 1 dB). - EitherOrTest: switching branches between calls, each block going only to the selected step. - RadeLoopbackTest: real speech through RADE TX and straight into RX syncs at a high SNR and comes out at the input's level; noise alone never syncs or produces audio; once sync is lost the SNR stops changing. Runs without Python, so also on Windows. Real speech comes from the RADE sources the build already fetches (rade_src/wav/all.wav, see test/SpeechSample.h); the Windows job ships a copy next to the tests. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit c9f45b37fbbe874cf35bd0ff1693953aa6614b7e Author: Mooneer Salem Date: Fri Oct 9 17:55:55 2026 -0700 BandwidthExpandStep: handle blocks larger than its input buffer. The input FIFO holds half a second (8000 samples). A larger block was written in one go, which the FIFO rejected outright, while the output count had already been set from it: the caller got up to three times the input's length of stale buffer contents instead of audio. Feed the FIFO in pieces that fit, processing whole frames as they become available. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit e8c0c079637c8c6baaca11db6422a0385fd41fb8 Author: Mooneer Salem Date: Fri Oct 9 17:45:01 2026 -0700 os: test the GUI-free parts; fix Linux thread names and repeated activity starts. New OsInterfaceTest covers the OS name sent to FreeDV Reporter, thread naming (read back from the OS), the low-latency activity and, off macOS, the microphone check. - Linux: names longer than 15 characters were rejected by pthread_setname_np (ERANGE), so freedv-gui's SerialController, RigPttDisconnect and RigFreqDisconnect threads were left unnamed. They're now shortened to 15 characters. - macOS: calling StartLowLatencyActivity() twice leaked the first activity, and its idle-sleep assertion, until the process exited. It now ends any existing activity first. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 380860b8d9eb19d9308cca2032c3971c6ef73a47 Author: Mooneer Salem Date: Fri Oct 9 17:15:37 2026 -0700 Give every unit test a 10-minute timeout; pin the radae scripts. Without a timeout a hung test ran until the CI job's 6-hour limit. MinimalTxRxThreadTest keeps its 1 hour. Its radae download (used only for loss.py) is pinned to a commit instead of tracking main, and is now a declared dependency of the test. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit bbfb3decde81810da5d3b7f38517265ac931afb8 Author: Mooneer Salem Date: Fri Oct 9 17:15:37 2026 -0700 FreeDVReporterTrafficTest: test the secure (TLS) connection. freedv-gui connects to FreeDV Reporter over TLS by default, but only the plain connection was tested end to end. The fake server can now serve over TLS, and new tests run the handshake and events (including one spanning several TLS records) over it, and check that a server whose certificate isn't trusted is refused. The runtime-generated test certificate moves to a shared header. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 328efa9cee826ace4a5001ade8334b3469c522d0 Author: Mooneer Salem Date: Fri Oct 9 17:15:37 2026 -0700 LevelAdjustTest: gain past full scale clips rather than wrapping. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 4ef7f7011d0a521ee88c5647bf25f077a6e40af9 Author: Mooneer Salem Date: Fri Oct 9 17:15:37 2026 -0700 ResampleTest: check the output of 44.1 kHz conversions. The existing tests covered only 8 <-> 48 kHz and only checked that about the right number of samples came out (they pass with a 2% ratio error). New tests stream 44.1 <-> 48 kHz and 44.1 <-> 8 kHz in 10 ms blocks and check the sample count (no drift), frequency and level of a tone. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 91bd4114d933397a270956e690dce3be6d899058 Author: Mooneer Salem Date: Fri Oct 9 17:15:37 2026 -0700 CsvReporter: quote fields containing a comma, quote or line break. RADE text's character set includes ',', so a callsign received over the air could add a column to the log. Fields are now quoted per RFC 4180. The test files also move from the working directory to the temporary directory. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 328296a6f32d2f3cfdec967ae1fec8bbd667d15f Author: Mooneer Salem Date: Fri Oct 9 17:15:37 2026 -0700 EventHandler: give every handler the arguments intact. operator() forwarded its arguments to each handler in turn, so with a by-value movable argument (e.g. std::string) the first handler moved it out and the rest got an empty one. Pass them as lvalues instead. No current freedv-gui use is affected (they take pointers, numbers or const references). New EventHandlerTest covers +=, =, clear() and this. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 90893a5aee0c0947bdb511577a0b2f80f8a07ab1 Author: Mooneer Salem Date: Fri Oct 9 16:33:36 2026 -0700 ulog_async: render an argument that didn't fit as . The first argument that didn't fit in a record rendered as nothing, while every conversion after it rendered as . Tests for each argument type running out, a conversion cut off by the render buffer, and the %i/%F/%E/%G/%A conversions. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 55b8ae1f1aa22676b76aabd41df4dd2b8785502a Author: Mooneer Salem Date: Fri Oct 9 16:33:36 2026 -0700 AudioPipelineTest: test resampling between steps. Multi-step pipelines with steps at different rates and a step that changes rate: each step must get audio at its own rate, the end resampler must follow the last step, and the tone must come out intact. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit f805c2100d59f593e34cf505e61ee2684ab87966 Author: Mooneer Salem Date: Fri Oct 9 16:33:36 2026 -0700 AgcStep: size the output buffer for the rate it actually runs at. An unsupported sample rate (e.g. 44100) falls back to 48 kHz, but the output buffer was sized from the requested rate, so a large block of 48 kHz audio overran it. Tests for that fallback and for the 20 dB maximum cut (the 12 dB maximum boost can't be reached: the silence gate caps the boost at 10 dB). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit d0899bc8093542e07d08f326954ce912f90e519e Author: Mooneer Salem Date: Fri Oct 9 16:33:36 2026 -0700 RadeTextUnitTest: test the on-air format, CRC rejection and character set. A reference framer builds frames independently of rade_text, so tests can pin the on-air format, check that a cleanly decoded frame with a wrong CRC is dropped (single bit errors were always corrected by LDPC before reaching the CRC check), and that undefined 6-bit codes and unencodable characters are skipped. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit d611844f5a59729605349b3716c14a3b99ed5fb9 Author: Mooneer Salem Date: Fri Oct 9 16:33:36 2026 -0700 FreeDVReporter: don't crash on a tx_report without a string last_tx. A missing or non-string last_tx built a std::string from a null pointer. Treat it like null (never transmitted). Tests now check every field of every server event missing, wrongly typed and null; payloads that aren't objects; events with no handler registered; and the remaining isValidForReporting() gates. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit a74809834ac8e61abf3e52fbcb83ac69d5a74f75 Author: Mooneer Salem Date: Fri Oct 9 16:33:36 2026 -0700 TcpConnectionHandler: don't let a slow DNS lookup hold up connecting. After an attempt to one address, the connect loop waited for the other address family's DNS lookup to finish before trying anything else, and once it ran out of addresses it waited for all lookups without checking the attempts already in flight. A slow or hanging AAAA lookup (common with broken IPv6 DNS) therefore delayed the IPv4 connection by the whole lookup time. Only collect lookups that have finished, and keep checking in-flight attempts while waiting for the rest. Tests for the Happy Eyeballs logic, with DNS answers scripted through a now-virtual resolveAddresses_(): IPv6 preferred when both resolve, a short wait for a slightly later IPv6 answer, slow IPv6 DNS not delaying IPv4 (single address and fallback to a second one), refused IPv6 falling back to IPv4, waiting for IPv4 when IPv6 returns nothing, no addresses at all, an unanswered address not blocking the next, and disconnect() during DNS. LoopbackTcpServer can now listen on ::1. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 2ee23e57c194c48d11dc3971c20036c40928e3fd Author: Mooneer Salem Date: Fri Oct 9 15:56:58 2026 -0700 Link libatomic when std::atomic needs it. Unoptimized clang builds against libstdc++ leave std::atomic::is_lock_free() as a call to libatomic's __atomic_is_lock_free, so RadeTextTest (and anything else linking RADEReceiveStep) failed to link. fdv_util now checks whether atomics link on their own and adds libatomic if they need it, which reaches every backend library and downstream projects. Drops the CI-only workaround from the coverage job. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 534e19f99fc86790d4dff0f8cc0f8d58700f7c13 Author: Mooneer Salem Date: Fri Oct 9 15:37:37 2026 -0700 CI: link libatomic in the clang coverage build. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 3286a527c4c4d02da512319d3b41303699a4b0fb Author: Mooneer Salem Date: Fri Oct 9 15:19:38 2026 -0700 CI: add a coverage job that posts a summary on the run's page. Builds with clang source-based coverage on Linux, runs the tests and writes per-file line/function/branch coverage to the job summary; the line-by-line HTML report is uploaded as the coverage-html artifact. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 349567f9e8e41a8e7a96fdf0f5d4c5a458be5a77 Author: Mooneer Salem Date: Fri Oct 9 13:31:40 2026 -0700 TcpConnectionHandlerTest: keep sending until a plain send stalls. Two 64 MB sends still completed on Windows loopback with no reader, so send until one is still pending after 300 ms (up to ~1 GB). On Linux and macOS the first send stalls, as before. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit a4bb8c48ed468dc736c4529a8313ada1826ded64 Author: Mooneer Salem Date: Fri Oct 9 13:18:48 2026 -0700 TcpConnectionHandlerTest: stall plain sends with a second send. Pinning buffer sizes didn't help: Winsock accepts any single send in full while the data it has queued is under SO_SNDBUF, so on Windows only a second send behind it stalls. Tests 16 (plain) and 22 now send twice and check the second. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 9ee9501380ae6db590d5c92b097293ef779f0179 Author: Mooneer Salem Date: Fri Oct 9 13:07:45 2026 -0700 TcpConnectionHandlerTest: pin small socket buffers for plain stalled sends. Windows accepted an entire 64 MB send on loopback while the peer wasn't reading, so Tests 16 (plain) and 22 never stalled. Give the client's send buffer and the server's receive buffer small fixed sizes instead. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 2dfaa194d23b875293129b682ac0a16cb69f249f Author: Mooneer Salem Date: Fri Oct 9 13:07:45 2026 -0700 TcpConnectionHandler: stop the receive thread after EOF or a read error. It queued a disconnect and went straight back to reading, so until the worker thread ran the disconnect (which can wait behind a long send) it spun, logging the same error and queueing more disconnects: 128 identical "read failed" lines in one second on Windows, and duplicate "EOF received" lines elsewhere. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 8ddd16866f933388a5f12ae80ba6cef50ce4c8ef Author: Mooneer Salem Date: Fri Oct 9 12:54:57 2026 -0700 Adjust tests for Windows. - Winsock reports a recv() timeout via WSAGetLastError(), not errno. - %Lf isn't compared with snprintf(): Windows' C library treats long double as double, unlike clang/mingw's 80-bit long double. - Windows loopback buffers well over 8 MB, so sends meant to stall on a peer that isn't reading use 64 MB there. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit b2e49bb3f283b860fee7b5ef6dea9fb8b240a9d1 Author: Mooneer Salem Date: Fri Oct 9 12:54:57 2026 -0700 Fix Windows-only bugs found by running the unit tests on Windows. - TcpConnectionHandler: a failed connect (e.g. refused) was never detected on Windows, which reports it in select()'s exception set, not the write set, so the attempt hung until disconnect() and a configured reconnect never happened. Also treat a non-zero SO_ERROR as a failure. - TcpConnectionHandler: honor SSL_CERT_FILE/SSL_CERT_DIR on Windows too, in addition to the Windows root store, as on other platforms. - CsvReporter: on Windows, tellp() right after opening in append mode is 0 even for a non-empty file, so every session appended another header line. Seek to the end before checking. - ulog_event_to_cstr(): the Windows fmemopen() replacement is backed by a temporary file and never writes into the buffer, so the result was whatever the buffer held before. Copy it out before closing. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit c2cf6f1c20be08a8e4abfcc65ec9799c01bf9ab0 Author: Mooneer Salem Date: Fri Oct 9 12:41:51 2026 -0700 CI: run the unit tests on Windows. The Windows build moves out of the matrix into its own job, which cross-compiles with llvm-mingw as before but with the unit tests, and uploads them with the DLLs they need. A windows-latest job then runs each test (10-minute limit each) and fails if any fails or hangs. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 664ff46948fbaa000374af35351cd4b83d262965 Author: Mooneer Salem Date: Fri Oct 9 12:41:51 2026 -0700 Make the unit tests build for Windows. - TestSocketCompat.h: one set of socket helpers (open/close, waiting for readability, setsockopt, timeouts, non-blocking mode) plus setenv and temp files, mapping to Winsock (initialized before main()) on Windows. Socket handles stay in ints: Winsock handles fit and INVALID_SOCKET becomes -1. It also undoes wincrypt.h's macros that clash with OpenSSL/LibreSSL headers. - LoopbackTcpServer, TcpConnectionHandlerTest, UdpHandlerTest, UdpReporterTest, PskReporterTest and UlogConfigTest use it (or, for UlogConfigTest, the same stderr capture as UlogAsyncTest). - TcpConnectionHandlerTest Test 21 gets the client's socket from the handler (via the test friend hook) instead of scanning fds, which can't work with Winsock handles. - SIGPIPE handling is POSIX-only; M_PI gets a fallback definition. - MinimalTxRxThreadTest is skipped when cross-compiling: it runs Python on the build host. All 29 tests cross-compile with llvm-mingw (with static LibreSSL, as freedv-gui's Windows build uses) and still pass on macOS. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit d1d0e3346cc438211afc7df10fc5d8b721d3f8b7 Author: Mooneer Salem Date: Fri Oct 9 11:24:07 2026 -0700 CI: add a macOS job built with static LibreSSL. freedv-gui's macOS release build uses USE_STATIC_LIBRESSL=1, but every CI job here used OpenSSL, so the shipping TLS library was never tested. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit bde1216f1ba202b5dd270deb46bc544bbdec4c43 Author: Mooneer Salem Date: Fri Oct 9 11:24:07 2026 -0700 TapTest: test the tap thread, overflow policy and destruction. The old test fed one sample, so the tap thread never ran, and its only check of the tapped data couldn't pass (the tap runs on a copy) and was non-fatal. Now: audio passes through untouched; the tapped step gets the same audio in order in 10 ms blocks; a tap that falls behind loses whole blocks without stalling execute(); destruction joins the thread and frees the tapped step. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit e6ba1d496de2be01d34db762dc07b86f524e1bbc Author: Mooneer Salem Date: Fri Oct 9 11:24:07 2026 -0700 TcpConnectionHandler: don't drop received data; ignore connect() while connected. - Received data was silently dropped when the 128 KB receive buffer was full (the write's result was ignored): a 1 MB burst to a busy receiver delivered only ~128 KB, which would corrupt a WebSocket stream. The receive thread now stops reading until the handler catches up, so the data waits in the socket and TCP flow control slows the sender. With TLS, data SSL has already decrypted is read without waiting on select(). - connect() (or a queued reconnect attempt) on a live connection redid setup on the live socket and replaced the running receive thread, calling std::terminate(). It's now ignored with a warning, and the connection parameters are only changed on the worker thread while disconnected (the receive thread reads usingTLS_). Tests 25/25b (1 MB burst to a slow receiver, plain and TLS) and 26 (connect() while connected) fail against the previous implementation. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 2b7ff1c6fc2d22863f97d3b1bbf6fe5891d2395c Author: Mooneer Salem Date: Fri Oct 9 10:43:26 2026 -0700 TcpConnectionHandlerTest: add plain-TCP reset and stalled-renegotiation send tests. - Test 22: the server resets the connection during a plain-TCP send that can't complete; write() must fail and the client disconnect. - Test 23: the server resets an idle plain-TCP connection; read() fails (rather than EOF) and the client disconnects. - Test 24: a TLS 1.2 renegotiation the server never completes leaves SSL_write() waiting to read; disconnect() must abandon the send (verified to fail without the cancel check in that wait). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 0cb29478abf3e6127df8187236c1e3f0c0db3646 Author: Mooneer Salem Date: Fri Oct 9 10:43:26 2026 -0700 ulog_async: render h/hh and unsupported conversions like printf. - %hhd/%hd/%hhu/%hu printed the full int argument (e.g. %hhd of 300 printed "300" where printf prints "44"): the length modifier is dropped when the conversion is rebuilt with "ll", so narrow the value when it is captured instead. - An unsupported %*d, %.*f or positional %1$d left the rest of the conversion in the output ("d"); skip the whole conversion. UlogAsyncTest gains tests comparing every supported conversion with snprintf(), unsupported conversions, argument/message/flag overflow, and start/stop/flush edge cases (ulog_async.cpp line coverage 77.5% -> 97.9%). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 3e675137a577ad7642187f344c7705c7fb6766e8 Author: Mooneer Salem Date: Fri Oct 9 09:54:41 2026 -0700 TcpConnectionHandlerTest: make Test 21 deterministic on Linux and LibreSSL. Test 21 relied on a full kernel send buffer to make the client's SSL_read() return SSL_ERROR_WANT_WRITE. How much room the kernel frees afterwards (buffer auto-tuning, ACKs piggybacked on the server's HelloRequest) differs by OS, so on Linux the ClientHello went out and the test failed; on macOS it could pass without reaching the branch. Now the test fails the client's TLS writes at the BIO level (a write callback on its socket BIO, so no BIO ownership changes, which differ between OpenSSL and LibreSSL), has the server request renegotiation without blocking for the reply, waits for SSL_want_write(), and only then fills the socket buffer until it stays full so the receive thread really waits for writability. Verified on macOS (OpenSSL 3) and Linux ARM (LibreSSL): passes under 4x parallel load, and fails with the old untimed select(). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit fb8d2748e5fcd236593a45c4aa686162f3150d96 Author: Mooneer Salem Date: Fri Oct 9 08:31:02 2026 -0700 TcpConnectionHandlerTest: make Test 21 wait for SSL_read() to want a write. Under parallel load the fixed 500 ms sleep could elapse before the client processed the HelloRequest, so the test passed without reaching the SSL_ERROR_WANT_WRITE path. Wait (under sslMutex_, via a test-only friend hook) until the client's SSL object reports SSL_want_write(), and SKIP if the client refuses to renegotiate. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 4d004961fa4a44421e421f325173924bab1007f2 Author: Mooneer Salem Date: Fri Oct 9 08:13:28 2026 -0700 TcpConnectionHandler: don't hang disconnect while SSL_read() waits to write. When SSL_read() returned SSL_ERROR_WANT_WRITE (e.g. a TLS 1.2 renegotiation arriving while the socket's send buffer is full), the receive thread waited for writability with no timeout. disconnect() joins that thread, so it hung for as long as the peer stopped reading. Wait in SELECT_SLICE_US slices instead, so the loop notices ssl_ being cleared. Adds TcpConnectionHandlerTest Test 21, which reproduces the hang (verified to fail with the old untimed select()), and SemaphoreTest. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 11241af52483885d2c4212f74a902e56729c475a Author: Mooneer Salem Date: Fri Oct 9 01:55:59 2026 -0700 Add TLS partial read/write tests; fix TLS write error message. TcpConnectionHandlerTest: - 15: an 8 MB TLS send to a server that isn't reading yet (SSL_write() returns SSL_ERROR_WANT_WRITE repeatedly) completes intact once it reads. - 16: disconnect() abandons a send blocked on a full buffer, plain and TLS. - 17: the server resetting the connection mid-send makes SSL_write() fail and the client disconnect, rather than hang. - 18: a corrupted TLS record from the server makes SSL_read() fail and the client disconnect, delivering nothing. - 19: a TLS 1.3 key update while the client's send is stalled; data stays intact and the connection keeps working under the new keys. - 20: TLS 1.2 renegotiation while the client's send is stalled: the stalled SSL_write() has to wait for the server's half of the new handshake (SSL_ERROR_WANT_READ). Reports SKIP if the TLS library won't renegotiate. Also correct the write path's error log, which said 'Unable to read'. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit ed7d67f69e008d4fdba8dbc12eb16b4f7520a338 Author: Mooneer Salem Date: Fri Oct 9 00:17:00 2026 -0700 Add ThreadedObject tests and ThreadedTimer lifetime/race tests. ThreadedObjectTest: task ordering, a destructor waiting for a task longer than 250 ms, no task running after destruction over 300 create/enqueue/ destroy cycles with a concurrent producer, and (Linux) waiting from the object's own task. ThreadedTimerTest: a stopped timer really stops, stop() waits for a running callback, destroying a timer just after its callback starts, a repeating timer stopped just after firing never resurrects, stop()/restart() from inside the callback, and concurrent create/start/destroy from four threads. Against the previous Linux implementation (Raspberry Pi 4) both programs failed every run (ThreadedObjectTest at the 250 ms case, ThreadedTimerTest with a segfault from a callback on a destroyed timer); against the previous macOS implementation ThreadedTimerTest failed ~1 in 8 runs under load. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 86d7add251931c6431c1a04d853ea657195fcaf3 Author: Mooneer Salem Date: Fri Oct 9 00:17:00 2026 -0700 ThreadedTimer: fix callback lifetime races; use one implementation everywhere. The timer server used on Linux and Windows had three races: - It read a timer's fire time after releasing its lock, so a timer stopped and destroyed in that window was used after free. - stop() didn't wait for a callback that was already running, so destroying a timer could free its callback (and whatever it uses) mid-call. - A repeating timer stopped while being rescheduled was put back on the queue after stop(), leaving a dangling pointer once it was destroyed. All scheduling state now lives under the server mutex, a repeating timer is rescheduled before (not after) its callback runs, and stop()/the destructor wait for a running callback unless called from that callback. The macOS GCD-based implementation had the same class of bug: a handler already dispatched could still run after stop() returned (calling a stopped or destroyed timer's callback -- seen as std::bad_function_call aborts under load), and a callback calling stop()/restart() on its own timer deadlocked on timerMutex_. Rather than maintain a second, macOS-only fix, macOS now uses the same timer server, with its thread at utility QoS as the GCD queue was. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 351d591cbded6becbb2c40d5b1a1a5cf6f3ac90a Author: Mooneer Salem Date: Fri Oct 9 00:17:00 2026 -0700 ThreadedObject (Linux): don't report idle while a task is starting. eventLoop_() dequeued a task under eventQueueMutex_ but only set taskCurrentlyExecuting_ after releasing it, so waitForAllTasksComplete_() could see an empty queue and nothing running in between, return, and let the object be destroyed under the task. waitForAllTasksComplete_() also gave up after ~250 ms, letting a destructor proceed while a longer task was still running. Set and clear the flag under the queue lock, read both under it, and wait without a timeout like the macOS implementation (logging if it takes over 2 s). A task waiting on its own object returns instead of waiting on itself. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 89964d7bb06421db36e791df19bd5e956fbce88e Author: Mooneer Salem Date: Thu Oct 8 23:18:24 2026 -0700 Tests: ignore SIGPIPE in socket test programs. The fake servers in TcpConnectionHandlerTest and FreeDVReporterTrafficTest write to clients that may already have hung up; e.g. in the untrusted- certificate test the client closes the connection after rejecting the cert while the server's SSL_accept() is still writing. With LibreSSL on Linux that write raised SIGPIPE and killed the test. Ignore SIGPIPE so it surfaces as a failed write instead. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit e6014abd6692117221b08120c062badd03550fbf Author: Mooneer Salem Date: Thu Oct 8 23:06:02 2026 -0700 TcpConnectionHandler: pick the first address list by results, not flags. Fixes an intermittent segfault in connectImpl_() seen on the Linux ARM CI runner (FreeDVReporterTrafficTest), a regression from 8894e13. That commit made the 'IPv6 empty, wait for IPv4' path collect the IPv4 result with ipv4ResultFuture.get() instead of polling ipv4Complete_. The resolver threads publish their result before setting ipv4Complete_, so get() can return while the flag still reads false; the following 'which list first' check then required ipv4Complete_, left whichIndex pointing at the empty IPv6 list, and socket() dereferenced a null addrinfo. On Linux, resolving an IPv4 literal as IPv6 fails immediately, so every loopback connection took this path. Choose the starting list from the collected results (a non-null list has necessarily been collected), and make the connect loop step to the non-empty list if it's ever pointed at an empty one. Reproduced on a Raspberry Pi 4 (Debian 13, GCC 14) running the test under gdb, 4 in parallel: 2 crashes in the first 8 runs before, none in 200 runs after. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit b5b1b2e66c33d388c6d12bcdf77d0755672017c4 Author: Mooneer Salem Date: Thu Oct 8 22:56:36 2026 -0700 Add tests for remaining pipeline steps, RADE reset, spin mutex and ulog config. - LinkStepTest: round trip, partial and drain-all reads, output bounded to one second, whole-block drop when full, clearFifo(), null/empty input. - MuteStepTest: silence at same/up/down/odd rates, empty input, full second. - ToneInterfererTest: tone level and phase continuity across blocks, adding to input, clipping at full scale, empty blocks. - RadeStepResetTest: reset() discards buffered TX/RX input (bit-identical to a fresh step on fresh RADE state), partially collected TX features and queued EOO samples; RX accessors. Each assertion was checked to fail with the corresponding line removed from reset(). - AudioSpinMutexTest: try_lock/unlock semantics, mutual exclusion under contention, blocking in lock(), and lock hand-off latency. - UlogConfigTest: level strings, set_level, set_quiet, set_lock, set_prefix_fn and ulog_event_to_cstr() incl. truncation. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 5c3f5af7541c991920ccc19e0144a2060efefc42 Author: Mooneer Salem Date: Thu Oct 8 22:56:36 2026 -0700 ulog: always NUL-terminate ulog_event_to_cstr() output. fmemopen() doesn't guarantee a terminator when the output fills the buffer (macOS leaves none), so a truncated message came back as an unterminated string. Terminate the last byte, and reject a zero-size buffer. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit e2f81958c2cc0b442f5df459c2ee106546d0b77e Author: Mooneer Salem Date: Thu Oct 8 22:56:36 2026 -0700 ToneInterfererStep: clip instead of wrapping when adding the tone. The tone was added to each short sample with '+=', so loud input plus the tone wrapped around to the opposite sign (30000 + 5000 -> -30536), turning a slight overload into a full-scale click. Sum in int and clamp to the short range. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit ddb91318b3c9bc26b5bbf4e0e62913e9c4bc3fff Author: Mooneer Salem Date: Thu Oct 8 22:56:36 2026 -0700 LinkStep: never return more than one second of audio per call. OutputStep's buffer holds one second at the link's sample rate, but the FIFO holds 48000 samples by default whatever the rate. A drain-all call (numInputSamples == 0, e.g. when a resampler ahead of it in freedv-gui's TX monitor pipeline produces no samples) or an oversized request with more than a second buffered wrote past the end of the buffer. Cap each read at the buffer size; the rest is returned by later calls. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 017282ff86ace30d78618a6ceca666ce05ed3ef7 Author: Mooneer Salem Date: Thu Oct 8 22:07:12 2026 -0700 Add PipelineResetTest: reset() must match a freshly constructed step. For ResampleStep (up/down), AgcStep (8 and 48 kHz), RNNoiseStep, BandwidthExpandStep, EitherOrStep (both branches) and a full AudioPipeline with inserted and result resamplers: a step that has processed loud audio and then been reset must produce bit-identical output to a new step fed the same quieter input. On failure it reports how many samples differ, where, and by how much. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 4bdd74dfb13a49cef77f2a9f049e0be6207d476a Author: Mooneer Salem Date: Thu Oct 8 22:07:12 2026 -0700 AgcStep: clear WebRTC limiter and loudness history on reset(). reset() zeroed the AGC's own gain variables but left the WebRTC limiter state and libebur128's 400 ms momentary-loudness window untouched. freedv-gui resets the TX pipeline on every RX->TX transition, so each transmission started with gain decisions based on the tail of the previous one: after a reset nearly every sample of the following second differed from a fresh AgcStep (by up to ~860 on a ~1000-amplitude test signal). Re-initialize the WebRTC limiter (no allocation) and, since libebur128 has no reset and recreating its state allocates on the real-time thread, feed it 400 ms of silence, which leaves it equivalent to a fresh state. Output after reset() is now bit-identical to a new AgcStep. Costs ~0.2 ms per reset at 48 kHz in a Debug build. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 031ca660ba999c8fc1683589591148052de809d2 Author: Mooneer Salem Date: Thu Oct 8 22:05:46 2026 -0700 Add PSK Reporter flush, UDP multicast and TLS handshake timeout tests. PskReporterTest: send reports to a loopback UDP socket instead of the live report.pskreporter.info (test 5 previously sent a real report on every run), and cover the 50-record auto-flush, destroying the reporter while a flush is in flight, and the destructor flushing unsent records. UdpHandlerTest (new, 5 tests): unicast IPv4/IPv6 sends, IPv4 and IPv6 multicast destinations (as UdpReporter uses), binding to a multicast group, and unparseable/non-local addresses. Multicast delivery checks are skipped when the host doesn't loop multicast back. TcpConnectionHandlerTest: a stalled TLS handshake gives up after the 10 s TLS_HANDSHAKE_TIMEOUT without a disconnect() call. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit f11ae25834b09ebbbc5d20d6b4925d379a03af48 Author: Mooneer Salem Date: Thu Oct 8 22:05:46 2026 -0700 PskReporter: don't let background sends outlive the reporter. send() ran reportCommon_() on a detached thread capturing 'this', so destroying the reporter right after a send (e.g. when PSK Reporter is turned off just after the 50-record auto-flush) let that thread use the freed object and its mutex, and the destructor could report the same records a second time. Keep the send thread joinable, join it before starting another and on destruction, and release recordListMutex_ before addReceiveRecord() calls send() so that join can't deadlock. Also make the server address a member (defaulting to the same defines) so tests can point reports at loopback, and free the getaddrinfo() result on the socket()/sendto() error paths. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit bf08f90f789ac1e45f4c891868d0cb91678848d5 Author: Mooneer Salem Date: Thu Oct 8 21:48:23 2026 -0700 Add TcpConnectionHandler and end-to-end FreeDVReporter tests. TcpConnectionHandlerTest (13 tests) exercises TcpConnectionHandler against an in-process loopback server: connect/send/receive incl. multi-chunk transfers, server and client disconnects, refused connections, reconnect timer, localhost IPv6->IPv4 fallback, unresolvable hosts, and (with TLS enabled) a verified TLS round trip using a runtime-generated self-signed certificate, untrusted certificates, non-TLS replies and cancelling a stalled handshake. FreeDVReporterTrafficTest (8 tests) drives a real FreeDVReporter against an in-process fake FreeDV Reporter server speaking WebSocket/engine.io/socket.io: auth payload and roles, state replay on connection_successful, all inbound events incl. bulk_update and malformed packets, all outbound reports, ping/pong, ping timeout, server-initiated disconnects, and reconnect while hidden. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 8894e13a129948c1d9afd4a3dc23eca5feb41fa9 Author: Mooneer Salem Date: Thu Oct 8 21:48:23 2026 -0700 TcpConnectionHandler: don't drop IPv4 DNS results that complete late. If IPv6 resolution finished with no results and IPv4 resolution finished between the 'collect completed results' check and the 'wait for IPv4' check, the latter saw ipv4Complete_ == true and skipped collecting the IPv4 result, leaving no addresses to try and forcing a 5 s reconnect. Decide based on whether the IPv4 future has been consumed instead. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit a49c98928599f6864250a4a7f0968eead13ea878 Author: Mooneer Salem Date: Thu Oct 8 21:48:23 2026 -0700 TcpConnectionHandler: serialize SSL_read()/SSL_write() across threads. SSL_write() runs on the ThreadedObject worker while SSL_read() runs on receiveThread_, both against the same SSL object with no locking, which OpenSSL/LibreSSL don't support. Under TLS 1.3 this randomly lost data in either direction (e.g. while session tickets were being processed). Route both calls (and their SSL_get_error()) through helpers holding sslMutex_, which is never held across select(). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 5a602eac3a31ec48e0d1be4b1fb07562e84cba39 Author: Mooneer Salem Date: Thu Oct 8 21:48:23 2026 -0700 TcpConnectionHandler: dispatch TLS data that ends on a read-size boundary. When the bytes available over TLS were an exact multiple of READ_SIZE_BYTES, the final SSL_read() returned SSL_ERROR_WANT_READ and the goto skipped the dispatch of everything already read on that pass. The data sat in receiveBuffer_ until more arrived (for FreeDV Reporter, potentially until the next engine.io ping). Break out to dispatch instead when data was read. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 982f77513626ece0ed4063ec4b55b95029f32f90 Author: Mooneer Salem Date: Thu Oct 8 20:37:41 2026 -0700 reporting: drop unused git_version link dependency. fdv_reporting doesn't reference any git_version symbols, and the git_version target only exists when built inside freedv-gui. The new reporting unit tests are the first standalone executables to link fdv_reporting, so standalone builds failed with 'cannot find -lgit_version'. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 0f0d24d452d50acb62f3daad118ce7766829cd04 Author: Mooneer Salem Date: Thu Oct 8 20:16:42 2026 -0700 Add unit tests for the reporting module Adds hermetic unit tests for CsvReporter, UdpReporter, PskReporter and FreeDVReporter (22 tests total), registered via DefineUnitTest under BUILD_BACKEND_UNITTESTS and runnable with: ctest -R reporting_ - CsvReporterTest: header written exactly once, record field/format correctness, unopenable path is a silent no-op. - UdpReporterTest: fdv_callsign JSON schema validated over a real loopback socket; non-record methods emit nothing; record frequency follows the addReceiveRecord argument. - PskReporterTest: SenderRecord wire layout (incl. >32-bit frequency), 4-byte payload padding, 0x99 0x92 / 0x99 0x93 record headers, reportCommon_ record drain, auto-flush threshold boundary. - FreeDVReporterTest: isValidForReporting gating, all event handlers dispatched directly with strict JSON type validation, bulk_update tolerance of malformed entries, pre-connect state save and connection_successful replay gate, analog-mode hide/show. Production changes required by the tests: - pskreporter.h: include (it declares std::vector members but only compiled because every .cpp included first). - pskreporter.h / FreeDVReporter.h: friend hooks granting the tests access to private encoding helpers / event handlers so no live server is needed. commit 4f5926235593a2389a22985f7acfea5352b5ce19 Merge: 2e0b200 8018330 Author: Mooneer Salem Date: Tue Oct 6 18:13:17 2026 -0700 Merge branch 'main' into ms-agc-tweaks commit 096a142e1b7326b3b9b292b34406ed55f4c01a07 Merge: 81f925b 8018330 Author: Mooneer Salem Date: Tue Oct 6 18:13:02 2026 -0700 Merge branch 'main' into radev2-dev commit 80183302230716029def1d0ae8655fb76f96d91e Author: Mooneer Salem Date: Tue Oct 6 18:12:26 2026 -0700 Revert RADE branch back to main. (#69) commit b7cf7911909d7c1542eea43434f0313f67e45f51 Author: Mooneer Salem Date: Tue Oct 6 17:59:58 2026 -0700 Revert RADE branch back to main. commit 2a55f0320d8e7b698e2d4d31d881a999e7f2e5a3 Author: Mooneer Salem Date: Mon Oct 5 17:18:45 2026 -0700 Make sure RADEV2 build fix works. commit 81f925bb34f12adccd28e4f5a689b2ca47d38d60 Author: Mooneer Salem Date: Mon Oct 5 09:06:38 2026 -0700 rade_text: combine repeated copies of the TX cycle on receive (#67) * rade_text: combine repeated copies of the TX cycle on receive. The transmitter repeats its LDPC(112,56) block cycle back to back, so summing received soft symbols modulo the cycle length coherently combines every copy heard so far. One accumulator is kept per possible cycle length (1-4 blocks); each is decoded at the same alignment instants as the raw sliding window, only after the raw window fails, so latency on strong signals and the one-callback-per-cycle behavior are unchanged. Copies decay by 0.7 per cycle so a changed message ages out. Through the RADE V2 C modem (RadeTextOtaSim), the SNR at which a one-block callsign decodes within 60s in 90% of trials improves from about -1 to -6 dB in AWGN (where RADE sync becomes the limit) and from about +2 to -5 dB on MPP. Also: - Add rade_text_rx_reset(), called by RADEReceiveStep when sync is lost since the position within the TX cycle is unknown afterward. - Add rade_text_enable_rx_combine_confirm() (off by default): requires a combined-only decode to repeat at the same alignment before delivery, restoring the no-combining false decode rate (~0.5/hr vs ~0.8/hr on noise) at a cost of up to ~1 dB and one more codeword of latency. - Move the LDPC encoder/decoder into an LDPCCode template so each rade_text instance owns its decoder state instead of sharing file-scope buffers; ldpc_encode()/ldpc_decode() remain as wrappers. - Add RadeTextSim and RadeTextOtaSim simulators and unit tests 18-19. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 * Fix clean-tree configure failure for RadeTextOtaSim. Linking rade directly without fdv_audio_pipeline made CMake's generate step fail on a clean build tree ("Imported target rade includes non-existent path .../rade_src/src"), since that directory doesn't exist until build_rade runs. Link it like RadeTextTest instead, using fdv_audio_pipeline's rade_text rather than compiling rade_text.cpp again. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 --------- Co-authored-by: Claude Opus 5.5 commit de15fc1e1ab40e58ffc065c2daef0230cf1a5943 Author: Mooneer Salem Date: Mon Oct 5 08:40:24 2026 -0700 Fix clean-tree configure failure for RadeTextOtaSim. Linking rade directly without fdv_audio_pipeline made CMake's generate step fail on a clean build tree ("Imported target rade includes non-existent path .../rade_src/src"), since that directory doesn't exist until build_rade runs. Link it like RadeTextTest instead, using fdv_audio_pipeline's rade_text rather than compiling rade_text.cpp again. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 4c88115646f54106ff4afe9c7bb869d5cb7ffff0 Author: Mooneer Salem Date: Mon Oct 5 08:15:22 2026 -0700 rade_text: combine repeated copies of the TX cycle on receive. The transmitter repeats its LDPC(112,56) block cycle back to back, so summing received soft symbols modulo the cycle length coherently combines every copy heard so far. One accumulator is kept per possible cycle length (1-4 blocks); each is decoded at the same alignment instants as the raw sliding window, only after the raw window fails, so latency on strong signals and the one-callback-per-cycle behavior are unchanged. Copies decay by 0.7 per cycle so a changed message ages out. Through the RADE V2 C modem (RadeTextOtaSim), the SNR at which a one-block callsign decodes within 60s in 90% of trials improves from about -1 to -6 dB in AWGN (where RADE sync becomes the limit) and from about +2 to -5 dB on MPP. Also: - Add rade_text_rx_reset(), called by RADEReceiveStep when sync is lost since the position within the TX cycle is unknown afterward. - Add rade_text_enable_rx_combine_confirm() (off by default): requires a combined-only decode to repeat at the same alignment before delivery, restoring the no-combining false decode rate (~0.5/hr vs ~0.8/hr on noise) at a cost of up to ~1 dB and one more codeword of latency. - Move the LDPC encoder/decoder into an LDPCCode template so each rade_text instance owns its decoder state instead of sharing file-scope buffers; ldpc_encode()/ldpc_decode() remain as wrappers. - Add RadeTextSim and RadeTextOtaSim simulators and unit tests 18-19. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011sR6sG6MEefCKp5bKJjWE2 commit 2e0b20027d352b57a186788d3e3b6e719d5349d5 Author: Mooneer Salem Date: Sun Oct 4 17:16:29 2026 -0700 Bring back WebRTC limiter, use EBU R 128 short-term measurement instead of momentary. commit ef00afe46c7b828d343391f0de7e8c9ede710cec Merge: bfdd116 1bf881b Author: Mooneer Salem Date: Thu Oct 1 18:22:58 2026 -0700 Merge branch 'main' into ms-agc-tweaks