Newer
Older
XinYang_IOS / Carthage / Checkouts / OpenVPNAdapter / Sources / OpenVPN3 / deps / asio / patches / 0002-Added-randomize-method-to-asio-ip-tcp-resolver-resul.patch
@zhangfeng zhangfeng on 7 Dec 1 KB 1.8.0
From fe57c9127cfc95b4673c6530f86edab5e6538425 Mon Sep 17 00:00:00 2001
From: James Yonan <james@openvpn.net>
Date: Wed, 2 Sep 2015 12:18:48 -0700
Subject: [PATCH] Added randomize() method to
 asio::ip::tcp::resolver::results_type.

---
 asio/include/asio/ip/basic_resolver_results.hpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/asio/include/asio/ip/basic_resolver_results.hpp b/asio/include/asio/ip/basic_resolver_results.hpp
index 3b3fad49..c070f7da 100644
--- a/asio/include/asio/ip/basic_resolver_results.hpp
+++ b/asio/include/asio/ip/basic_resolver_results.hpp
@@ -18,6 +18,7 @@
 #include "asio/detail/config.hpp"
 #include <cstddef>
 #include <cstring>
+#include <algorithm>
 #include "asio/detail/socket_ops.hpp"
 #include "asio/detail/socket_types.hpp"
 #include "asio/ip/basic_resolver_iterator.hpp"
@@ -299,6 +300,12 @@ public:
     return !a.equal(b);
   }
 
+  template <typename Random>
+  void randomize(Random& r)
+  {
+    std::shuffle(this->values_->begin(), this->values_->end(), r);
+  }
+
 private:
   typedef std::vector<basic_resolver_entry<InternetProtocol> > values_type;
 };
-- 
2.21.0