Skip to content

Commit b940273

Browse files
committed
fix(PrimaryClient): clear sticky stop flag before deliberate reconnect
reconnectStream() did stream_.close() + stream_.connect() without clearing the sticky stop_requested_ cancellation flag introduced in 5b22c97 ("make connection attempts cancellable to unblock teardown"). PrimaryClient::stop()/~PrimaryClient() set the flag via stream_.requestStop() so a producer thread stuck in TCPSocket::setup() aborts promptly at teardown. The flag is sticky and only cleared on (re)start (URProducer::setupProducer, RTDEClient::init). A deliberate reconnect via reconnectStream() never cleared it, so after stopPrimaryClientCommunication() any resendRobotProgram() call failed: TCPSocket::setup() bailed out at the up-front stop_requested_ check and logged "Failed to reconnect primary stream!". This regressed UrDriverTest.send_robot_program_retry_on_failure on every integration runner. Clear the flag in reconnectStream() before connecting, mirroring URProducer::setupProducer(); a deliberate reconnect is a restart and must not honor a stale teardown cancellation. Co-authored-by: Rune Søe-Knudsen <urrsk@users.noreply.github.com>
1 parent 5b22c97 commit b940273

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/primary/primary_client.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,10 @@ bool PrimaryClient::reconnectStream()
551551
{
552552
URCL_LOG_DEBUG("Closing primary stream...");
553553
stream_.close();
554+
// A deliberate reconnect must clear any sticky cancellation left by a prior stop()/teardown
555+
// (stream_.requestStop()), otherwise TCPSocket::setup() aborts immediately and the reconnect
556+
// fails. Mirrors URProducer::setupProducer() which clears the flag before (re)connecting.
557+
stream_.clearStop();
554558
if (stream_.connect())
555559
{
556560
URCL_LOG_DEBUG("Primary stream connected");

0 commit comments

Comments
 (0)