From be6c4b273dcc4045c934f7e6e7137cda45fda79f Mon Sep 17 00:00:00 2001 From: Leonardo Di Donato Date: Wed, 27 May 2020 20:03:09 +0000 Subject: [PATCH] new(userspace/falco): gRPC context for bidirectional services Co-authored-by: Lorenzo Fontana Signed-off-by: Leonardo Di Donato --- userspace/falco/grpc_context.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/userspace/falco/grpc_context.h b/userspace/falco/grpc_context.h index 22784790..b77653d9 100644 --- a/userspace/falco/grpc_context.h +++ b/userspace/falco/grpc_context.h @@ -63,5 +63,24 @@ public: mutable bool m_has_more = false; }; +class bidi_context : public context +{ +public: + bidi_context(::grpc::ServerContext* ctx): + context(ctx){}; + ~bidi_context() = default; + + enum : char + { + WAIT_CONNECT = 1, + READY_TO_WRITE, + WAIT_WRITE_DONE, + FINISHED, + } m_status = WAIT_CONNECT; + + mutable void* m_stream = nullptr; // todo(fntlnz, leodido) > useful in the future + mutable bool m_has_more = false; // fixme > needed? +}; + } // namespace grpc } // namespace falco