X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvpp-api%2Fvapi%2Fvapi.hpp;h=a1e33a93fd4f9fd06c729ca00f15a340c914e72d;hb=dab732a18c39d13af1770b55d7cef2359ea66412;hp=893851a0dbbb20676899a2a07e16ede6212d45de;hpb=fd67ece3d3eda0bd896aaa166d89b4f8e7f4e98f;p=vpp.git diff --git a/src/vpp-api/vapi/vapi.hpp b/src/vpp-api/vapi/vapi.hpp index 893851a0dbb..a1e33a93fd4 100644 --- a/src/vpp-api/vapi/vapi.hpp +++ b/src/vpp-api/vapi/vapi.hpp @@ -195,15 +195,17 @@ public: * @param name application name * @param chroot_prefix shared memory prefix * @param max_queued_request max number of outstanding requests queued + * @param handle_keepalives handle memclnt_keepalive automatically * * @return VAPI_OK on success, other error code on error */ vapi_error_e connect (const char *name, const char *chroot_prefix, - int max_outstanding_requests, int response_queue_size) + int max_outstanding_requests, int response_queue_size, + bool handle_keepalives = true) { return vapi_connect (vapi_ctx, name, chroot_prefix, max_outstanding_requests, response_queue_size, - VAPI_MODE_BLOCKING); + VAPI_MODE_BLOCKING, handle_keepalives); } /** @@ -245,7 +247,7 @@ public: * * @return VAPI_OK on success, other error code on error */ - vapi_error_e dispatch (const Common_req *limit = nullptr) + vapi_error_e dispatch (const Common_req *limit = nullptr, u32 time = 5) { std::lock_guard lock (dispatch_mutex); vapi_error_e rv = VAPI_OK; @@ -254,7 +256,8 @@ public: { void *shm_data; size_t shm_data_size; - rv = vapi_recv (vapi_ctx, &shm_data, &shm_data_size); + rv = vapi_recv (vapi_ctx, &shm_data, &shm_data_size, SVM_Q_TIMEDWAIT, + time); if (VAPI_OK != rv) { return rv; @@ -578,14 +581,14 @@ private: static void set_msg_id (vapi_msg_id_t id) { - assert ((INVALID_MSG_ID == *msg_id_holder ()) || + assert ((VAPI_INVALID_MSG_ID == *msg_id_holder ()) || (id == *msg_id_holder ())); *msg_id_holder () = id; } static vapi_msg_id_t *msg_id_holder () { - static vapi_msg_id_t my_id{INVALID_MSG_ID}; + static vapi_msg_id_t my_id{VAPI_INVALID_MSG_ID}; return &my_id; }