aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'src/vcl')
-rw-r--r--src/vcl/vppcom.c11
-rw-r--r--src/vcl/vppcom.h11
2 files changed, 21 insertions, 1 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index d217058370e..ae45be3b359 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -4490,6 +4490,17 @@ vppcom_session_get_error (uint32_t session_handle)
return VPPCOM_OK;
}
+int
+vppcom_worker_is_detached (void)
+{
+ vcl_worker_t *wrk = vcl_worker_get_current ();
+
+ if (!vcm->cfg.use_mq_eventfd)
+ return VPPCOM_ENOTSUP;
+
+ return wrk->api_client_handle == ~0;
+}
+
/*
* fd.io coding-style-patch-verification: ON
*
diff --git a/src/vcl/vppcom.h b/src/vcl/vppcom.h
index 6e15cd17cd4..08724cc31d8 100644
--- a/src/vcl/vppcom.h
+++ b/src/vcl/vppcom.h
@@ -102,7 +102,8 @@ typedef enum
VPPCOM_ENOPROTOOPT = -ENOPROTOOPT,
VPPCOM_EPIPE = -EPIPE,
VPPCOM_ENOENT = -ENOENT,
- VPPCOM_EADDRINUSE = -EADDRINUSE
+ VPPCOM_EADDRINUSE = -EADDRINUSE,
+ VPPCOM_ENOTSUP = -ENOTSUP
} vppcom_error_t;
typedef enum
@@ -272,6 +273,14 @@ extern int vppcom_worker_mqs_epfd (void);
*/
extern int vppcom_session_get_error (uint32_t session_handle);
+/**
+ * Returns true if current worker is disconnected from vpp
+ *
+ * Application can use this API to check if VPP is disconnected
+ * as long as `use-mq-eventfd` is being set
+ */
+extern int vppcom_worker_is_detached (void);
+
/* *INDENT-OFF* */
#ifdef __cplusplus
}
5'>185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262