summaryrefslogtreecommitdiffstats
path: root/src/vlibmemory
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-11-28 14:21:21 -0800
committerDave Barach <openvpp@barachs.net>2019-12-11 19:26:27 +0000
commitd4c709222b67f6c45ee7064637f69de9e9509222 (patch)
tree364288596630120840ec37dc6df3fd23b94cf7dd /src/vlibmemory
parent0aa4013e20471a7b23bc3252649c95c81b5d7519 (diff)
vcl: separate binary api connections per thread worker
Type: fix Change-Id: I2d72efc74a3b0a5b9e4da265475b1b01bf361125 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vlibmemory')
-rw-r--r--src/vlibmemory/socket_client.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/vlibmemory/socket_client.c b/src/vlibmemory/socket_client.c
index 5483110ae76..b7d4f2d6e54 100644
--- a/src/vlibmemory/socket_client.c
+++ b/src/vlibmemory/socket_client.c
@@ -260,10 +260,10 @@ vl_socket_client_enable_disable (int enable)
vl_socket_client_enable_disable2 (socket_client_ctx, enable);
}
-clib_error_t *
-vl_sock_api_recv_fd_msg (int socket_fd, int fds[], int n_fds, u32 wait)
+static clib_error_t *
+vl_sock_api_recv_fd_msg_internal (socket_client_main_t * scm, int fds[],
+ int n_fds, u32 wait)
{
- socket_client_main_t *scm = socket_client_ctx;
char msgbuf[16];
char ctl[CMSG_SPACE (sizeof (int) * n_fds)
+ CMSG_SPACE (sizeof (struct ucred))];
@@ -275,8 +275,11 @@ vl_sock_api_recv_fd_msg (int socket_fd, int fds[], int n_fds, u32 wait)
pid_t pid __attribute__ ((unused));
uid_t uid __attribute__ ((unused));
gid_t gid __attribute__ ((unused));
+ int socket_fd;
f64 timeout;
+ socket_fd = scm->client_socket.fd;
+
iov[0].iov_base = msgbuf;
iov[0].iov_len = 5;
mh.msg_iov = iov;
@@ -324,6 +327,26 @@ vl_sock_api_recv_fd_msg (int socket_fd, int fds[], int n_fds, u32 wait)
return 0;
}
+clib_error_t *
+vl_sock_api_recv_fd_msg (int socket_fd, int fds[], int n_fds, u32 wait)
+{
+ return vl_sock_api_recv_fd_msg_internal (socket_client_ctx, fds, n_fds,
+ wait);
+}
+
+clib_error_t *
+vl_sock_api_recv_fd_msg2 (socket_client_main_t * scm, int socket_fd,
+ int fds[], int n_fds, u32 wait)
+{
+ socket_client_main_t *old_ctx;
+ clib_error_t *error;
+
+ old_ctx = vl_socket_client_ctx_push (scm);
+ error = vl_sock_api_recv_fd_msg_internal (scm, fds, n_fds, wait);
+ vl_socket_client_ctx_pop (old_ctx);
+ return error;
+}
+
static void vl_api_sock_init_shm_reply_t_handler
(vl_api_sock_init_shm_reply_t * mp)
{
@@ -562,7 +585,7 @@ vl_socket_client_recv_fd_msg2 (socket_client_main_t * scm, int fds[],
{
if (!scm->socket_fd)
return clib_error_return (0, "no socket");
- return vl_sock_api_recv_fd_msg (scm->client_socket.fd, fds, n_fds, wait);
+ return vl_sock_api_recv_fd_msg_internal (scm, fds, n_fds, wait);
}
clib_error_t *