summaryrefslogtreecommitdiffstats
path: root/src/vcl/vppcom.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vcl/vppcom.c')
-rw-r--r--src/vcl/vppcom.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 6a1bf1cfcc7..2c2cb2c186b 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -22,7 +22,6 @@
__thread uword __vcl_worker_index = ~0;
-
static int
vcl_wait_for_segment (u64 segment_handle)
{
@@ -1594,9 +1593,9 @@ vppcom_session_connect (uint32_t session_handle, vppcom_endpt_t * server_ep)
if (PREDICT_FALSE (session->session_state & CLIENT_STATE_OPEN))
{
- VDBG (0, "VCL<%d>: vpp handle 0x%llx, sid %u: session already "
+ VDBG (0, "session handle %u [0x%llx]: session already "
"connected to %s %U port %d proto %s, state 0x%x (%s)",
- getpid (), session->vpp_handle, session_handle,
+ session_handle, session->vpp_handle,
session->transport.is_ip4 ? "IPv4" : "IPv6",
format_ip46_address,
&session->transport.rmt_ip, session->transport.is_ip4 ?
@@ -1616,9 +1615,8 @@ vppcom_session_connect (uint32_t session_handle, vppcom_endpt_t * server_ep)
sizeof (ip6_address_t));
session->transport.rmt_port = server_ep->port;
- VDBG (0, "VCL<%d>: vpp handle 0x%llx, sid %u: connecting to server %s %U "
- "port %d proto %s",
- getpid (), session->vpp_handle, session_handle,
+ VDBG (0, "session handle %u [0x%llx]: connecting to server %s %U "
+ "port %d proto %s", session_handle, session->vpp_handle,
session->transport.is_ip4 ? "IPv4" : "IPv6",
format_ip46_address,
&session->transport.rmt_ip, session->transport.is_ip4 ?
@@ -2993,7 +2991,7 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
vcl_worker_t *wrk = vcl_worker_get_current ();
vcl_session_t *session;
int rv = VPPCOM_OK;
- u32 *flags = buffer;
+ u32 *flags = buffer, tmp_flags = 0;
vppcom_endpt_t *ep = buffer;
session = vcl_session_get_w_handle (wrk, session_handle);
@@ -3004,8 +3002,7 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
{
case VPPCOM_ATTR_GET_NREAD:
rv = vppcom_session_read_ready (session);
- VDBG (2, "VCL<%d>: VPPCOM_ATTR_GET_NREAD: sid %u, nread = %d",
- getpid (), rv);
+ VDBG (2, "VPPCOM_ATTR_GET_NREAD: sid %u, nread = %d", rv);
break;
case VPPCOM_ATTR_GET_NWRITE:
@@ -3514,6 +3511,26 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
rv = vcl_session_get_refcnt (session);
break;
+ case VPPCOM_ATTR_SET_SHUT:
+ if (*flags == SHUT_RD || *flags == SHUT_RDWR)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_SHUT_RD);
+ if (*flags == SHUT_WR || *flags == SHUT_RDWR)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_SHUT_WR);
+ break;
+
+ case VPPCOM_ATTR_GET_SHUT:
+ if (VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_SHUT_RD))
+ tmp_flags = 1;
+ if (VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_SHUT_WR))
+ tmp_flags |= 2;
+ if (tmp_flags == 1)
+ *(int *) buffer = SHUT_RD;
+ else if (tmp_flags == 2)
+ *(int *) buffer = SHUT_WR;
+ else if (tmp_flags == 3)
+ *(int *) buffer = SHUT_RDWR;
+ *buflen = sizeof (int);
+ break;
default:
rv = VPPCOM_EINVAL;
break;
@@ -3620,7 +3637,7 @@ vppcom_poll (vcl_poll_t * vp, uint32_t n_sids, double wait_for_time)
for (i = 0; i < n_sids; i++)
{
- session = vcl_session_get (wrk, vp[i].sid);
+ session = vcl_session_get (wrk, vp[i].sh);
if (!session)
{
vp[i].revents = POLLHUP;
@@ -3695,7 +3712,7 @@ vppcom_poll (vcl_poll_t * vp, uint32_t n_sids, double wait_for_time)
for (i = 0; i < n_sids; i++)
{
clib_warning ("VCL<%d>: vp[%d].sid %d (0x%x), .events 0x%x, "
- ".revents 0x%x", getpid (), i, vp[i].sid, vp[i].sid,
+ ".revents 0x%x", getpid (), i, vp[i].sh, vp[i].sh,
vp[i].events, vp[i].revents);
}
}