Skip to content

Commit 6968371

Browse files
committed
Fixed address parsing of string for shdr connector and upped version to 2.7.0.5
1 parent 21e375b commit 6968371

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set(AGENT_VERSION_MAJOR 2)
33
set(AGENT_VERSION_MINOR 7)
44
set(AGENT_VERSION_PATCH 0)
5-
set(AGENT_VERSION_BUILD 4)
5+
set(AGENT_VERSION_BUILD 5)
66
set(AGENT_VERSION_RC "")
77

88
# This minimum version is to support Visual Studio 2019 and C++ feature checking and FetchContent

‎src/mtconnect/source/adapter/shdr/connector.cpp‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ namespace mtconnect::source::adapter::shdr {
136136
return true;
137137
}
138138

139+
/// @brief Attempt to reconnect after a delay. If the server is a hostname, re-resolve it to get the current IP
140+
/// address in case it has changed. If the server is a static IP address, just reconnect.
139141
inline void Connector::asyncTryConnect()
140142
{
141143
NAMED_SCOPE("Connector::asyncTryConnect");
@@ -148,9 +150,9 @@ namespace mtconnect::source::adapter::shdr {
148150
// Re-resolve hostname to handle DHCP/dynamic IP environments.
149151
// If the server is a hostname (not a static IP), re-resolve to get
150152
// the current IP address in case it has changed.
151-
boost::system::error_code parseEc;
152-
asio::ip::address::from_string(m_server, parseEc);
153-
if (parseEc)
153+
boost::system::error_code addrEc;
154+
ip::make_address(m_server, addrEc);
155+
if (addrEc)
154156
{
155157
// m_server is a hostname, re-resolve it
156158
asio::dispatch(m_strand, boost::bind(&Connector::resolve, this));

0 commit comments

Comments
 (0)