From b3a063bdac9c7be99d8077f4c44c20d6d0fa75f9 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 7 May 2018 16:30:51 -0700 Subject: [PATCH] modules/console: Rework fed key query to allow vector of queries. --- modules/console.cc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/console.cc b/modules/console.cc index 67f0d6287..5b50652fc 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -4808,24 +4808,32 @@ console_cmd__fed__key__query(opt &out, const string_view &line) { const params param{line, " ", { - "server_name", "key_id", "remote" + "remote", "[server_name,key_id]...", }}; - const unique_buffer buf{24_KiB}; - const std::pair requesting[] + const auto requests { - { param.at(0), param.at(1) } + tokens_after(line, ' ', 0) }; + std::vector> r; + tokens(requests, ' ', [&r] + (const string_view &req) + { + r.emplace_back(split(req, ',')); + }); + m::v1::key::opts opts; + opts.dynamic = true; opts.remote = net::hostport { - param.at(2, param.at(0)) + param.at(0) }; + const unique_buffer buf{24_KiB}; m::v1::key::query request { - requesting, buf, std::move(opts) + r, buf, std::move(opts) }; request.wait(out.timeout);