aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl/vppcom.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-10-20 18:44:41 -0700
committerDamjan Marion <dmarion@me.com>2020-10-21 11:07:09 +0000
commit5824cc52d1a000b4c4b2ed5da2f1b7761888f0cc (patch)
treebfca555061ce8bf1804bf476298aff2f25f38c97 /src/vcl/vppcom.c
parent5980e539d424469fc2869c94f709b8b24d7bc077 (diff)
vcl: wait for sendto to connect if needed
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I39948b046c79dea1b034619e1eaa22dd8a4997fb
Diffstat (limited to 'src/vcl/vppcom.c')
-rw-r--r--src/vcl/vppcom.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 947bf287e2d..229a251846f 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -3683,21 +3683,28 @@ vppcom_session_sendto (uint32_t session_handle, void *buffer,
if (ep)
{
- if (s->session_type != VPPCOM_PROTO_UDP
- || (s->flags & VCL_SESSION_F_CONNECTED))
+ if (!vcl_session_is_cl (s))
return VPPCOM_EINVAL;
/* Session not connected/bound in vpp. Create it by 'connecting' it */
if (PREDICT_FALSE (s->session_state == VCL_STATE_CLOSED))
{
+ u32 session_index = s->session_index;
+ f64 timeout = vcm->cfg.session_timeout;
+ int rv;
+
vcl_send_session_connect (wrk, s);
+ rv = vppcom_wait_for_session_state_change (session_index,
+ VCL_STATE_READY,
+ timeout);
+ if (rv < 0)
+ return rv;
+ s = vcl_session_get (wrk, session_index);
}
- else
- {
- s->transport.is_ip4 = ep->is_ip4;
- s->transport.rmt_port = ep->port;
- vcl_ip_copy_from_ep (&s->transport.rmt_ip, ep);
- }
+
+ s->transport.is_ip4 = ep->is_ip4;
+ s->transport.rmt_port = ep->port;
+ vcl_ip_copy_from_ep (&s->transport.rmt_ip, ep);
}
if (flags)