Skip to content

Commit

Permalink
Merge pull request #197 from QuantumEntangledAndy/master
Browse files Browse the repository at this point in the history
Fixed support to contact both ipv4 and ipv6 hosts
  • Loading branch information
s-vincent authored Jun 14, 2019
2 parents 6f14cf9 + fd5e650 commit 3f4078a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion libs/asiotap/include/asiotap/types/ip_endpoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ namespace asiotap
template <typename AddressType>
inline void async_resolve(const base_ip_endpoint<AddressType>& ep, typename base_ip_endpoint<AddressType>::resolver& resolver, typename base_ip_endpoint<AddressType>::resolver::protocol_type protocol, typename base_ip_endpoint<AddressType>::resolver::query::flags flags, const std::string& default_service, typename base_ip_endpoint<AddressType>::handler handler)
{
typename base_ip_endpoint<AddressType>::resolver::query query(protocol, ep.address().to_string(), ep.has_port() ? boost::lexical_cast<std::string>(ep.port()) : default_service, flags);
static_cast<void>(protocol);
typename base_ip_endpoint<AddressType>::resolver::query query(ep.address().to_string(), ep.has_port() ? boost::lexical_cast<std::string>(ep.port()) : default_service, flags | boost::asio::ip::resolver_query_base::numeric_host);

resolver.async_resolve(query, handler);
}
Expand Down
2 changes: 1 addition & 1 deletion libs/fscp/include/fscp/server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ namespace fscp
void async_send_to(const SharedBuffer& data, const size_t size, const ep_type& target, simple_handler_type handler)
{
const void_handler_type write_handler = [this, data, size, target, handler] () {
m_socket.async_send_to(buffer(data, size), target, 0, [data, handler] (const boost::system::error_code& ec, size_t) {
m_socket.async_send_to(buffer(data, size), to_socket_format(target), 0, [data, handler] (const boost::system::error_code& ec, size_t) {
handler(ec);
});
};
Expand Down
4 changes: 1 addition & 3 deletions libs/fscp/src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ namespace fscp

server::ep_type server::to_socket_format(const server::ep_type& ep)
{
#ifdef WINDOWS
#if defined(WINDOWS) || defined(MACINTOSH)
if (m_socket.local_endpoint().address().is_v6() && ep.address().is_v4())
{
return server::ep_type(boost::asio::ip::address_v6::v4_mapped(ep.address().to_v4()), ep.port());
Expand All @@ -1079,8 +1079,6 @@ namespace fscp
return ep;
}
#else
static_cast<void>(ep);

return ep;
#endif
}
Expand Down

0 comments on commit 3f4078a

Please sign in to comment.