Skip to content

Commit

Permalink
Fix build errors with boost 1.87
Browse files Browse the repository at this point in the history
  • Loading branch information
AnarManafov committed Jan 3, 2025
1 parent ef44486 commit e5b820f
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 70 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ cmake_install.cmake
CPackConfig.cmake
CPackSourceConfig.cmake
*.xcodeproj


# VS Code
.vscode/
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")

# Set policy CMP0167 to NEW to suppress the warning about FindBoost module removal
if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()

set(PROJECT_CXX_STANDARD 17)
# Handle C++ standard level
Expand Down Expand Up @@ -261,7 +265,7 @@ endif(Boost_FOUND)
#
# Search for protobuf
#
find_package(Protobuf 3.15 REQUIRED)
find_package(Protobuf REQUIRED)
add_subdirectory(proto)

# DDS Misc Common
Expand Down
7 changes: 3 additions & 4 deletions dds-agent/src/AgentConnectionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CAgentConnectionManager::CAgentConnectionManager(const SOptions_t& _options)
m_signals.add(SIGTERM);
#if defined(SIGQUIT)
m_signals.add(SIGQUIT);
#endif // defined(SIGQUIT)
#endif // defined(SIGQUIT

doAwaitStop();
}
Expand Down Expand Up @@ -167,8 +167,7 @@ void CAgentConnectionManager::createCommanderChannel(uint64_t _protocolHeaderID)

// Resolve endpoint iterator from host and port
tcp::resolver resolver(m_context);
tcp::resolver::query query(sHost, sPort);
tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);
auto endpoints = resolver.resolve(sHost, sPort);

// Create new agent and push handshake message
m_commanderChannel = CCommanderChannel::makeNew(m_context, _protocolHeaderID, m_intercomContext);
Expand All @@ -181,7 +180,7 @@ void CAgentConnectionManager::createCommanderChannel(uint64_t _protocolHeaderID)
{ this->on_cmdSHUTDOWN(_sender, _attachment, m_commanderChannel); });

// Connect to DDS commander
m_commanderChannel->connect(endpoint_iterator);
m_commanderChannel->connect(endpoints);
}

void CAgentConnectionManager::on_cmdSHUTDOWN(const SSenderInfo& /*_sender*/,
Expand Down
3 changes: 2 additions & 1 deletion dds-agent/src/CommanderChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,8 @@ bool CCommanderChannel::on_cmdSTOP_USER_TASK(SCommandAttachmentImpl<cmdSTOP_USER
// Prevent blocking of the current thread.
// The term-kill logic is posted to a different free thread in the queue.
LOG(info) << "Scheduling a task stop for Slot id = " << _sender.m_ID << "; pid = " << slot->m_pid;
m_ioContext.post(
boost::asio::post(
m_ioContext,
[this, slot, id = _sender.m_ID]
{
terminateChildrenProcesses(
Expand Down
5 changes: 2 additions & 3 deletions dds-intercom-lib/src/IntercomServiceCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ void CIntercomServiceCore::setupChannel(const std::string& _sessionID)

// Resolve endpoint iterator from host and port
boost::asio::ip::tcp::resolver resolver(m_io_context);
boost::asio::ip::tcp::resolver::query query(sHost, sPort);
boost::asio::ip::tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);
auto endpoints = resolver.resolve(sHost, sPort);

// Create new communication channel and push handshake message
m_channel = CAgentChannel::makeNew(m_io_context, 0);
Expand Down Expand Up @@ -199,7 +198,7 @@ void CIntercomServiceCore::setupChannel(const std::string& _sessionID)
});
});

m_channel->connect(endpoint_iterator);
m_channel->connect(endpoints);
}

void CIntercomServiceCore::stop()
Expand Down
2 changes: 1 addition & 1 deletion dds-misc-lib/src/Process.h
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ namespace dds::misc
return pid;
}

boost::asio::io_service ios;
boost::asio::io_context ios;
bp::async_pipe outPipe(ios);
bp::async_pipe errPipe(ios);
boost::asio::streambuf outBuf;
Expand Down
26 changes: 13 additions & 13 deletions dds-protocol-lib/src/BaseChannelImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace dds
class CClientChannelImpl; // needed for friend class
template <class T>
class CServerChannelImpl; // needed for friend class
} // namespace protocol_api
} // namespace protocol_api
} // namespace dds

// Either raw message or command based processing can be used at a time
Expand Down Expand Up @@ -465,18 +465,18 @@ namespace dds

// process standard async writing
auto self(this->shared_from_this());
m_ioContext.post(
[this, self]
{
try
{
writeMessage();
}
catch (std::exception& ex)
{
LOG(dds::misc::error) << "BaseChannelImpl can't write message: " << ex.what();
}
});
boost::asio::post(m_ioContext,
[this, self]
{
try
{
writeMessage();
}
catch (std::exception& ex)
{
LOG(dds::misc::error) << "BaseChannelImpl can't write message: " << ex.what();
}
});
}

template <ECmdType _cmd, class A>
Expand Down
75 changes: 39 additions & 36 deletions dds-protocol-lib/src/BaseSMChannelImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -449,18 +449,19 @@ namespace dds
auto self(this->shared_from_this());
for (const auto& v : m_transportIn)
{
m_ioContext.post(
[this, self, &v]
{
try
{
readMessage(v);
}
catch (std::exception& ex)
{
LOG(dds::misc::error) << "BaseSMChannelImpl can't read message: " << ex.what();
}
});
boost::asio::post(m_ioContext,
[this, self, &v]
{
try
{
readMessage(v);
}
catch (std::exception& ex)
{
LOG(dds::misc::error)
<< "BaseSMChannelImpl can't read message: " << ex.what();
}
});
}

SSenderInfo sender;
Expand Down Expand Up @@ -536,18 +537,19 @@ namespace dds

// process standard async writing
auto self(this->shared_from_this());
m_ioContext.post(
[this, self, &buffer]
{
try
{
writeMessage(buffer);
}
catch (std::exception& ex)
{
LOG(dds::misc::error) << "BaseSMChannelImpl can't write message: " << ex.what();
}
});
boost::asio::post(m_ioContext,
[this, self, &buffer]
{
try
{
writeMessage(buffer);
}
catch (std::exception& ex)
{
LOG(dds::misc::error)
<< "BaseSMChannelImpl can't write message: " << ex.what();
}
});
}
catch (std::exception& ex)
{
Expand Down Expand Up @@ -681,18 +683,19 @@ namespace dds
pThis->processMessage(_currentMsg);

auto self(this->shared_from_this());
m_ioContext.post(
[this, self, &_info]
{
try
{
readMessage(_info);
}
catch (std::exception& ex)
{
LOG(dds::misc::error) << "BaseSMChannelImpl can't read message: " << ex.what();
}
});
boost::asio::post(m_ioContext,
[this, self, &_info]
{
try
{
readMessage(_info);
}
catch (std::exception& ex)
{
LOG(dds::misc::error)
<< "BaseSMChannelImpl can't read message: " << ex.what();
}
});
}
}

Expand Down
6 changes: 3 additions & 3 deletions dds-protocol-lib/src/ClientChannelImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ namespace dds
connect(m_endpoint_iterator);
}

void connect(boost::asio::ip::tcp::resolver::iterator _endpoint_iterator)
void connect(boost::asio::ip::tcp::resolver::results_type _endpoint_iterator)
{
m_endpoint_iterator = _endpoint_iterator;
boost::asio::async_connect(
this->socket(),
_endpoint_iterator,
[this](boost::system::error_code ec, boost::asio::ip::tcp::resolver::iterator)
[this](boost::system::error_code ec, boost::asio::ip::tcp::endpoint)
{
if (!ec)
{
Expand Down Expand Up @@ -102,7 +102,7 @@ namespace dds
}

private:
boost::asio::ip::tcp::resolver::iterator m_endpoint_iterator;
boost::asio::ip::tcp::resolver::results_type m_endpoint_iterator;
};
} // namespace protocol_api
} // namespace dds
Expand Down
17 changes: 9 additions & 8 deletions dds-protocol-lib/src/ConnectionManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,14 +390,15 @@ namespace dds
{
// Post each push call, otherwise it will block other pushes until "post" each block of the
// binary file if the file is big.
this->m_ioContext.post(
[&]
{
if (v.m_channel.expired())
return;
auto ptr = v.m_channel.lock();
ptr->pushBinaryAttachmentCmd(_data, _fileName, _cmdSource, v.m_protocolHeaderID);
});
boost::asio::post(this->m_ioContext,
[&]
{
if (v.m_channel.expired())
return;
auto ptr = v.m_channel.lock();
ptr->pushBinaryAttachmentCmd(
_data, _fileName, _cmdSource, v.m_protocolHeaderID);
});
}
}
catch (std::bad_weak_ptr& e)
Expand Down

0 comments on commit e5b820f

Please sign in to comment.