test: gate DisconnectMidWrite test on writer connection to fix race
TCPImageCommTest_DisconnectMidWrite_NoHang launched the sender before the puller's connection was accepted by the pusher's background accept thread. When StartDataCollection ran first it threw "No writers connected", which escaped the sender lambda (re-thrown by sender.get()) and starved the receiver thread's PollImage, whose REQUIRE failure aborted with SIGABRT. Wait for GetConnectedWriters()==1 before starting, matching every other test in the file. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -510,6 +510,11 @@ TEST_CASE("TCPImageCommTest_DisconnectMidWrite_NoHang", "[TCP]") {
|
||||
TCPStreamPusher pusher("tcp://127.0.0.1:*", 1);
|
||||
TCPImagePuller puller(pusher.GetAddress()[0], 64 * 1024 * 1024);
|
||||
|
||||
// Wait for the puller to connect before starting data collection
|
||||
for (int attempt = 0; attempt < 100 && pusher.GetConnectedWriters() < 1; ++attempt)
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
REQUIRE(pusher.GetConnectedWriters() == 1);
|
||||
|
||||
std::thread receiver([&] {
|
||||
bool disconnected = false;
|
||||
while (!disconnected) {
|
||||
|
||||
Reference in New Issue
Block a user