Skip to content

Commit 1853580

Browse files
authored
Changed num_retries from static to an unsigned int (UniversalRobots#136)
The num_retries wouldn't be reset within each function, but it will now so the correct number of retries is performed in each function, before throwing an exception.
1 parent 09adab9 commit 1853580

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/rtde/rtde_client.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ bool RTDEClient::init()
6161
return true;
6262
}
6363

64-
static unsigned attempts = 0;
64+
unsigned int attempts = 0;
6565
while (attempts < MAX_INITIALIZE_ATTEMPTS)
6666
{
6767
setupCommunication();
@@ -144,7 +144,7 @@ bool RTDEClient::negotiateProtocolVersion(const uint16_t protocol_version)
144144
{
145145
// Protocol version should always be 1 before starting negotiation
146146
parser_.setProtocolVersion(1);
147-
static unsigned num_retries = 0;
147+
unsigned int num_retries = 0;
148148
uint8_t buffer[4096];
149149
size_t size;
150150
size_t written;
@@ -190,7 +190,7 @@ bool RTDEClient::negotiateProtocolVersion(const uint16_t protocol_version)
190190

191191
void RTDEClient::queryURControlVersion()
192192
{
193-
static unsigned num_retries = 0;
193+
unsigned int num_retries = 0;
194194
uint8_t buffer[4096];
195195
size_t size;
196196
size_t written;
@@ -236,7 +236,7 @@ void RTDEClient::queryURControlVersion()
236236

237237
void RTDEClient::setupOutputs(const uint16_t protocol_version)
238238
{
239-
static unsigned num_retries = 0;
239+
unsigned int num_retries = 0;
240240
size_t size;
241241
size_t written;
242242
uint8_t buffer[4096];
@@ -316,7 +316,7 @@ void RTDEClient::setupOutputs(const uint16_t protocol_version)
316316

317317
void RTDEClient::setupInputs()
318318
{
319-
static unsigned num_retries = 0;
319+
unsigned int num_retries = 0;
320320
size_t size;
321321
size_t written;
322322
uint8_t buffer[4096];
@@ -487,7 +487,7 @@ bool RTDEClient::sendStart()
487487
}
488488

489489
std::unique_ptr<RTDEPackage> package;
490-
static unsigned num_retries = 0;
490+
unsigned int num_retries = 0;
491491
while (num_retries < MAX_REQUEST_RETRIES)
492492
{
493493
if (!pipeline_.getLatestProduct(package, std::chrono::milliseconds(1000)))

0 commit comments

Comments
 (0)