update(userspace/falco): use concurrent output queue in grpc server impl

Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
This commit is contained in:
Leonardo Di Donato 2019-09-06 14:05:57 +00:00 committed by Leo Di Donato
parent 5f29d46cb3
commit 4f23b0bdfb
2 changed files with 2 additions and 11 deletions

View File

@ -37,6 +37,7 @@ void falco_grpc_server_impl::subscribe(const stream_context& ctx, const falco_ou
} }
else else
{ {
auto m_event_queue = falco_output_queue::get().queue();
// Start (or continue) streaming // Start (or continue) streaming
// ctx.m_status == stream_context::STREAMING // ctx.m_status == stream_context::STREAMING
if(m_event_queue.try_pop(res) && !req.keepalive()) if(m_event_queue.try_pop(res) && !req.keepalive())

View File

@ -20,26 +20,16 @@ limitations under the License.
#include <atomic> #include <atomic>
#include "tbb/concurrent_queue.h" #include "falco_output_queue.h"
#include "falco_output.grpc.pb.h" #include "falco_output.grpc.pb.h"
#include "falco_output.pb.h"
#include "grpc_context.h" #include "grpc_context.h"
typedef tbb::concurrent_queue<falco_output_response> falco_output_response_cq;
class falco_grpc_server_impl class falco_grpc_server_impl
{ {
public: public:
falco_grpc_server_impl() = default; falco_grpc_server_impl() = default;
~falco_grpc_server_impl() = default; ~falco_grpc_server_impl() = default;
falco_output_response_cq& m_event_queue;
falco_grpc_server_impl(falco_output_response_cq& event_queue):
m_event_queue(event_queue)
{
}
protected: protected:
bool is_running(); bool is_running();