Skip to content
This repository was archived by the owner on Jul 8, 2022. It is now read-only.

Commit 4f8a0ba

Browse files
authored
Merge pull request #716 from bourtemb/fix-nb_endpoints-connect_event_channel-9.3
Fix nb_endpoints in ZmqEventConsumer::connect_event_channel
2 parents cd4abdd + 11ca194 commit 4f8a0ba

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

cppapi/client/zmqeventconsumer.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,21 +1294,29 @@ void ZmqEventConsumer::connect_event_channel(string &channel_name,TANGO_UNUSED(D
12941294
// If the server has returned several possible ZMQ endpoints (because several NIC boards on server host), check which
12951295
// one is correct
12961296
//
1297+
size_t nb_endpoints = ev_svr_data->svalue.length();
12971298

1298-
size_t nb_endpoint = ev_svr_data->svalue.length();
1299-
nb_endpoint = nb_endpoint >> 1;
1299+
Tango::DevLong server_tango_lib_version = ev_svr_data->lvalue[0];
1300+
if(server_tango_lib_version >= 930)
1301+
{
1302+
// ZmqEventSubscriptionChange returns the ZMQ message filters used for the attribute
1303+
// and for the heartbeat events at the end of the string array part of the returned DevVarLongStringArray
1304+
nb_endpoints -= 2;
1305+
}
1306+
1307+
nb_endpoints = nb_endpoints >> 1;
13001308
size_t valid_endpoint = 0;
13011309

1302-
if (nb_endpoint != 1)
1310+
if (nb_endpoints != 1)
13031311
{
1304-
for (valid_endpoint = 0;valid_endpoint < nb_endpoint;valid_endpoint++)
1312+
for (valid_endpoint = 0; valid_endpoint < nb_endpoints; valid_endpoint++)
13051313
{
13061314
string endpoint(ev_svr_data->svalue[valid_endpoint << 1]);
13071315
if (check_zmq_endpoint(endpoint) == true)
13081316
break;
13091317
}
13101318

1311-
if (valid_endpoint == nb_endpoint)
1319+
if (valid_endpoint == nb_endpoints)
13121320
{
13131321
stringstream o;
13141322

0 commit comments

Comments
 (0)