Skip to content

Commit 19bb920

Browse files
Updated TCP connect to use range based overload
1 parent 38a4f42 commit 19bb920

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/lib/transport/DataSubscriber.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,11 +1255,10 @@ void DataSubscriber::Connect(const string& hostname, const uint16_t port, const
12551255
if (m_connected)
12561256
throw SubscriberException("Subscriber is already connected; disconnect first");
12571257

1258-
// Let any pending connect operation complete before disconnect - prevents destruction disconnect before connection is completed
1258+
// Let any pending connect or disconnect operation complete before new connect - prevents destruction disconnect before connection is completed
12591259
ScopeLock lock(m_connectActionMutex);
12601260
DnsResolver resolver(m_commandChannelService);
12611261
const DnsResolver::query dnsQuery(hostname, to_string(port));
1262-
const DnsResolver::iterator endpointIterator = resolver.resolve(dnsQuery);
12631262
ErrorCode error;
12641263

12651264
m_disconnected = false;
@@ -1272,15 +1271,15 @@ void DataSubscriber::Connect(const string& hostname, const uint16_t port, const
12721271

12731272
m_connector.SetConnectionRefused(false);
12741273

1275-
const DnsResolver::iterator hostEndpoint = connect(m_commandChannelSocket, endpointIterator, error);
1274+
const TcpEndPoint hostEndpoint = connect(m_commandChannelSocket, resolver.resolve(dnsQuery), error);
12761275

12771276
if (error)
12781277
throw SystemError(error);
12791278

12801279
if (!m_commandChannelSocket.is_open())
12811280
throw SubscriberException("Failed to connect to host");
12821281

1283-
m_hostAddress = hostEndpoint->endpoint().address();
1282+
m_hostAddress = hostEndpoint.address();
12841283

12851284
#if BOOST_LEGACY
12861285
m_commandChannelService.reset();

0 commit comments

Comments
 (0)