@@ -54,22 +54,26 @@ class ParallelTcpConnector
5454 * @param connected callback function when a connection succeeds; may be
5555 * called multiple times if it does not call Succeeded()
5656 * before returning
57+ * @param ipv4Only true if only IPv4 addresses should be returned; otherwise
58+ * both IPv4 and IPv6 addresses are returned
5759 * @return Parallel connector
5860 */
5961 static std::shared_ptr<ParallelTcpConnector> Create (
6062 wpi::uv::Loop& loop, wpi::uv::Timer::Time reconnectRate,
61- wpi::Logger& logger, std::function<void (wpi::uv::Tcp& tcp)> connected) {
63+ wpi::Logger& logger, std::function<void (wpi::uv::Tcp& tcp)> connected,
64+ bool ipv4Only = false) {
6265 if (loop.IsClosing ()) {
6366 return nullptr ;
6467 }
65- return std::make_shared<ParallelTcpConnector>(
66- loop, reconnectRate, logger, std::move (connected), private_init{});
68+ return std::make_shared<ParallelTcpConnector>(loop, reconnectRate, logger,
69+ std::move (connected),
70+ ipv4Only, private_init{});
6771 }
6872
6973 ParallelTcpConnector (wpi::uv::Loop& loop, wpi::uv::Timer::Time reconnectRate,
7074 wpi::Logger& logger,
7175 std::function<void (wpi::uv::Tcp& tcp)> connected,
72- const private_init&);
76+ bool ipv4Only, const private_init&);
7377 ~ParallelTcpConnector ();
7478
7579 ParallelTcpConnector (const ParallelTcpConnector&) = delete ;
@@ -111,6 +115,7 @@ class ParallelTcpConnector
111115 wpi::uv::Loop& m_loop;
112116 wpi::Logger& m_logger;
113117 wpi::uv::Timer::Time m_reconnectRate;
118+ bool m_ipv4Only;
114119 std::function<void (wpi::uv::Tcp& tcp)> m_connected;
115120 std::shared_ptr<wpi::uv::Timer> m_reconnectTimer;
116121 std::vector<std::pair<std::string, unsigned int >> m_servers;
0 commit comments