From 5663d4d02b1e8ca7af4b685d2831664640f04248 Mon Sep 17 00:00:00 2001 From: Leonardo Di Donato Date: Thu, 6 Feb 2020 22:01:44 +0000 Subject: [PATCH] update(userspace/falco): major, minor, patch are digits, so use integers Signed-off-by: Leonardo Di Donato --- userspace/falco/config_falco.h.in | 6 +++--- userspace/falco/grpc_server_impl.cpp | 23 ++++++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/userspace/falco/config_falco.h.in b/userspace/falco/config_falco.h.in index c0848922..865ded79 100644 --- a/userspace/falco/config_falco.h.in +++ b/userspace/falco/config_falco.h.in @@ -19,9 +19,9 @@ limitations under the License. #define FALCO_BRANCH "@FALCO_REF@" #define FALCO_HASH "@FALCO_HASH@" #define FALCO_VERSION "@FALCO_VERSION@" -#define FALCO_VERSION_MAJOR "@FALCO_VERSION_MAJOR@" -#define FALCO_VERSION_MINOR "@FALCO_VERSION_MINOR@" -#define FALCO_VERSION_PATCH "@FALCO_VERSION_PATCH@" +#define FALCO_VERSION_MAJOR @FALCO_VERSION_MAJOR@ +#define FALCO_VERSION_MINOR @FALCO_VERSION_MINOR@ +#define FALCO_VERSION_PATCH @FALCO_VERSION_PATCH@ #define FALCO_VERSION_PRERELEASE "@FALCO_VERSION_PRERELEASE@" #define FALCO_VERSION_BUILD "@FALCO_VERSION_BUILD@" diff --git a/userspace/falco/grpc_server_impl.cpp b/userspace/falco/grpc_server_impl.cpp index 8216b86a..e74cb1e7 100644 --- a/userspace/falco/grpc_server_impl.cpp +++ b/userspace/falco/grpc_server_impl.cpp @@ -32,11 +32,14 @@ void falco::grpc::server_impl::subscribe(const stream_context& ctx, const output { if(ctx.m_status == stream_context::SUCCESS || ctx.m_status == stream_context::ERROR) { + // todo(leodido) > log "status=ctx->m_status, stream=ctx->m_stream" ctx.m_stream = nullptr; } else { - // Streaming + // Start or continue streaming + // todo(leodido) > check for m_status == stream_context::STREAMING? + // todo(leodido) > set m_stream if(output::queue::get().try_pop(res) && !req.keepalive()) { ctx.m_has_more = true; @@ -52,12 +55,18 @@ void falco::grpc::server_impl::subscribe(const stream_context& ctx, const output void falco::grpc::server_impl::version(const context& ctx, const version::request&, version::response& res) { - res.set_version(FALCO_VERSION); - res.set_major(std::stoi(FALCO_VERSION_MAJOR)); - res.set_minor(std::stoi(FALCO_VERSION_MINOR)); - res.set_patch(std::stoi(FALCO_VERSION_PATCH)); - res.set_prerelease(FALCO_VERSION_PRERELEASE); - res.set_build(FALCO_VERSION_BUILD); + auto& build = *res.mutable_build(); + build = FALCO_VERSION_BUILD; + + auto& prerelease = *res.mutable_prerelease(); + prerelease = FALCO_VERSION_PRERELEASE; + + auto& version = *res.mutable_version(); + version = FALCO_VERSION; + + res.set_major(FALCO_VERSION_MAJOR); + res.set_minor(FALCO_VERSION_MINOR); + res.set_patch(FALCO_VERSION_PATCH); } void falco::grpc::server_impl::shutdown()