Hi Chetan,

I think that in this case it's better to use blocking interface, as you
are waiting for the events to come.

You can take a look at test/ext/vapi_c_test.c - tests called 
test_stats_1, _2 & _3 deal with stats - first two show a blocking,
efficient interface, third one is non-blocking, which in this case
busy-loops until it gets the stats.

Thanks,
Klement


On Fri, 2018-08-17 at 17:18 +0530, chetan bhasin wrote:
> Hi Klement,
> 
> Thanks for your reply!
> 
> The exact problem statement is , we are trying to send some events
> from VPP
> to client app , but client is not able to read those events api
> messages
> until it has some pending requests. So as a work-around we are
> sending
> control ping after few seconds from client to have at least one
> request
> pending from client side.
> 
> Thanks,
> Chetan Bhasin
> 
> On Fri, Aug 17, 2018 at 4:26 PM, Klement Sekera <[email protected]>
> wrote:
> 
> > 
> > What exactly is the issue? According to vapi_dispatch() docstring
> > this
> > is expected:
> > 
> > /**
> >  * @brief loop vapi_dispatch_one until responses to all currently
> > outstanding
> >  * requests have been received and their callbacks called
> >  *
> >  * @note the dispatch loop is interrupted if any error is
> > encountered
> > or
> >  * returned from the callback, in which case this error is returned
> > as
> > the
> >  * result of vapi_dispatch. In this case it might be necessary to
> > call
> > dispatch
> >  * again to process the remaining messages. Returning VAPI_EUSER
> > from
> >  * a callback allows the user to break the dispatch loop (and
> > distinguish
> >  * this case in the calling code from other failures). VAPI never
> > returns
> >  * VAPI_EUSER on its own.
> >  *
> >  * @return VAPI_OK on success, other error code on error
> >  */
> >   vapi_error_e vapi_dispatch (vapi_ctx_t ctx);
> > 
> > What are you trying to achieve?
> > 
> > Thanks,
> > Klement
> > 
> > 
> > On Fri, 2018-08-17 at 15:52 +0530, chetan bhasin wrote:
> > > 
> > > Hi,
> > > 
> > > We are facing an issue during usage of API framework.
> > > 
> > > We have open a Non-blocking connection from Client app.
> > > 
> > > If Client does not have any pending request then it skip reading
> > > the
> > > responses in vapi_dispatch . Please suggest
> > > 
> > > vapi_error_e
> > > vapi_dispatch (vapi_ctx_t ctx)
> > > {
> > >   vapi_error_e rv = VAPI_OK;
> > > *  while (!vapi_requests_empty (ctx))*
> > >     {
> > >       rv = vapi_dispatch_one (ctx);
> > >       if (VAPI_OK != rv)
> > >     {
> > >       return rv;
> > >     }
> > >     }
> > >   return rv;
> > > }
> > > 
> > > 
> > > Thanks,
> > > Chetan Bhasin
> > > -=-=-=-=-=-=-=-=-=-=-=-
> > > Links: You receive all messages sent to this group.
> > > 
> > > View/Reply Online (#10196): https://lists.fd.io/g/vpp-dev/message
> > > /101
> > > 96
> > > Mute This Topic: https://lists.fd.io/mt/24611122/675704
> > > Group Owner: [email protected]
> > > Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [ksekera@cisco.
> > > com]
> > > -=-=-=-=-=-=-=-=-=-=-=-
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#10200): https://lists.fd.io/g/vpp-dev/message/10200
Mute This Topic: https://lists.fd.io/mt/24611122/21656
Group Owner: [email protected]
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to