From 260683704489e442f72db8b2957a9e705236a593 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 29 Dec 2017 22:52:11 -0700 Subject: [PATCH] ircd::net: Use fixed result stack buffer. --- ircd/net.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ircd/net.cc b/ircd/net.cc index 9f2359251..abedfe012 100644 --- a/ircd/net.cc +++ b/ircd/net.cc @@ -1517,11 +1517,13 @@ ircd::net::resolve::resolve(const hostport &hostport, if(eptr) return callback(std::move(eptr), {}); - static const size_t max{64}; - const size_t result_count{results.size()}; - const size_t count{std::min(max, result_count)}; + static const size_t max{32}; + const size_t count + { + results.size() + }; - ipport vector[count]; + ipport vector[max]; std::transform(begin(results), end(results), vector, [] (const auto &entry) { @@ -1529,7 +1531,7 @@ ircd::net::resolve::resolve(const hostport &hostport, }); assert(!eptr); - callback(std::move(eptr), vector_view(vector, count)); + callback(std::move(eptr), vector); }); }