mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 00:31:14 +00:00
Fix type conflict for some environments
This commit is contained in:
parent
cab5511795
commit
de7ddc0ddd
|
@ -29,6 +29,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace fair
|
namespace fair
|
||||||
{
|
{
|
||||||
|
@ -133,18 +134,19 @@ inline std::string getDefaultRouteNetworkInterface()
|
||||||
inline std::string getIpFromHostname(const std::string& hostname)
|
inline std::string getIpFromHostname(const std::string& hostname)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
namespace bai = boost::asio::ip;
|
||||||
boost::asio::io_service ios;
|
boost::asio::io_service ios;
|
||||||
boost::asio::ip::tcp::resolver resolver(ios);
|
bai::tcp::resolver resolver(ios);
|
||||||
boost::asio::ip::tcp::resolver::query query(hostname, "");
|
bai::tcp::resolver::query query(hostname, "");
|
||||||
boost::asio::ip::tcp::resolver::iterator end;
|
bai::tcp::resolver::iterator end;
|
||||||
|
|
||||||
auto it = std::find_if(resolver.resolve(query), end, [](const boost::asio::ip::tcp::endpoint& ep) {
|
auto it = std::find_if(static_cast<bai::basic_resolver_iterator<bai::tcp>>(resolver.resolve(query)), end, [](const bai::tcp::endpoint& ep) {
|
||||||
return ep.address().is_v4();
|
return ep.address().is_v4();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (it != end) {
|
if (it != end) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << static_cast<boost::asio::ip::tcp::endpoint>(*it).address();
|
ss << static_cast<bai::tcp::endpoint>(*it).address();
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,17 +162,18 @@ inline std::string getIpFromHostname(const std::string& hostname)
|
||||||
inline std::string getIpFromHostname(const std::string& hostname, boost::asio::io_service& ios)
|
inline std::string getIpFromHostname(const std::string& hostname, boost::asio::io_service& ios)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
boost::asio::ip::tcp::resolver resolver(ios);
|
namespace bai = boost::asio::ip;
|
||||||
boost::asio::ip::tcp::resolver::query query(hostname, "");
|
bai::tcp::resolver resolver(ios);
|
||||||
boost::asio::ip::tcp::resolver::iterator end;
|
bai::tcp::resolver::query query(hostname, "");
|
||||||
|
bai::tcp::resolver::iterator end;
|
||||||
|
|
||||||
auto it = std::find_if(resolver.resolve(query), end, [](const boost::asio::ip::tcp::endpoint& ep) {
|
auto it = std::find_if(static_cast<bai::basic_resolver_iterator<bai::tcp>>(resolver.resolve(query)), end, [](const bai::tcp::endpoint& ep) {
|
||||||
return ep.address().is_v4();
|
return ep.address().is_v4();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (it != end) {
|
if (it != end) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << static_cast<boost::asio::ip::tcp::endpoint>(*it).address();
|
ss << static_cast<bai::tcp::endpoint>(*it).address();
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user