vcl: propagate correctly EADDRINUSE for UDP bind
Change-Id: Ia8b5421cbaaf861ddb3ad7aeca53a077ff18864e
Signed-off-by: Mohammed Hawari <mohammed@hawari.fr>
Type: fix
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index e929fa1..d9c3b30 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -545,6 +545,7 @@
{
session->session_state = VCL_STATE_DETACHED;
session->vpp_handle = mp->handle;
+ session->vpp_error = mp->retval;
return sid;
}
else
@@ -1161,7 +1162,10 @@
}
if (session->session_state == VCL_STATE_DETACHED)
{
- return VPPCOM_ECONNREFUSED;
+ if (session->vpp_error == SESSION_E_ALREADY_LISTENING)
+ return VPPCOM_EADDRINUSE;
+ else
+ return VPPCOM_ECONNREFUSED;
}
if (svm_msg_q_sub (wrk->app_event_queue, &msg, SVM_Q_NOWAIT, 0))
@@ -1678,7 +1682,7 @@
vcl_evt (VCL_EVT_BIND, session);
if (session->session_type == VPPCOM_PROTO_UDP)
- vppcom_session_listen (session_handle, 10);
+ return vppcom_session_listen (session_handle, 10);
return VPPCOM_OK;
}