summaryrefslogtreecommitdiffstats
path: root/src/vcl/ldp.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-11-26 17:01:36 -0800
committerDamjan Marion <dmarion@me.com>2018-11-29 11:27:18 +0000
commit47c40e2d944c9a29677d0542103207ba8372b66a (patch)
treee43cf5361213d119df53fb16c15cf0dca550f2d4 /src/vcl/ldp.c
parent743ee3e12531ec3c6ba2e2add694dde3361b0e03 (diff)
vcl: basic support for apps that fork
- intercept fork and register a new worker with vpp - share sessions between parent and forked child - keep binary api state per worker Change-Id: Ib177517d661724fa042bd2d98d18e777056352a2 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vcl/ldp.c')
-rw-r--r--src/vcl/ldp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c
index 5c70643ed24..915d1caa40c 100644
--- a/src/vcl/ldp.c
+++ b/src/vcl/ldp.c
@@ -346,7 +346,7 @@ ldp_init (void)
int
close (int fd)
{
- int rv;
+ int rv, refcnt;
const char *func_str;
u32 sid = ldp_sid_from_fd (fd);
@@ -388,13 +388,15 @@ close (int fd)
LDBG (0, "LDP<%d>: fd %d (0x%x): calling %s(): sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
+ refcnt = vppcom_session_attr (sid, VPPCOM_ATTR_GET_REFCNT, 0, 0);
rv = vppcom_session_close (sid);
if (rv != VPPCOM_OK)
{
errno = -rv;
rv = -1;
}
- ldp_fd_free_w_sid (sid);
+ if (refcnt == 1)
+ ldp_fd_free_w_sid (sid);
}
else
{