vcl: mark app state as failed if attach fails

Change-Id: If6c3b9a9136390fb740e5c00fd270b7962a1c4ab
Signed-off-by: Florin Coras <fcoras@cisco.com>
This commit is contained in:
Florin Coras
2019-03-20 08:33:10 -07:00
committed by Dave Barach
parent 8863123bad
commit a5efca30f5

View File

@ -118,9 +118,8 @@ vl_api_application_attach_reply_t_handler (vl_api_application_attach_reply_t *
if (mp->retval) if (mp->retval)
{ {
clib_warning ("VCL<%d>: attach failed: %U", getpid (), VERR ("attach failed: %U", format_api_error, ntohl (mp->retval));
format_api_error, ntohl (mp->retval)); goto failed;
return;
} }
wrk->app_event_queue = uword_to_pointer (mp->app_event_queue_address, wrk->app_event_queue = uword_to_pointer (mp->app_event_queue_address,
@ -128,8 +127,8 @@ vl_api_application_attach_reply_t_handler (vl_api_application_attach_reply_t *
segment_handle = clib_net_to_host_u64 (mp->segment_handle); segment_handle = clib_net_to_host_u64 (mp->segment_handle);
if (segment_handle == VCL_INVALID_SEGMENT_HANDLE) if (segment_handle == VCL_INVALID_SEGMENT_HANDLE)
{ {
clib_warning ("invalid segment handle"); VERR ("invalid segment handle");
return; goto failed;
} }
if (mp->n_fds) if (mp->n_fds)
@ -141,12 +140,12 @@ vl_api_application_attach_reply_t_handler (vl_api_application_attach_reply_t *
if (vcl_segment_attach (vcl_vpp_worker_segment_handle (0), if (vcl_segment_attach (vcl_vpp_worker_segment_handle (0),
"vpp-mq-seg", SSVM_SEGMENT_MEMFD, "vpp-mq-seg", SSVM_SEGMENT_MEMFD,
fds[n_fds++])) fds[n_fds++]))
return; goto failed;
if (mp->fd_flags & SESSION_FD_F_MEMFD_SEGMENT) if (mp->fd_flags & SESSION_FD_F_MEMFD_SEGMENT)
if (vcl_segment_attach (segment_handle, (char *) mp->segment_name, if (vcl_segment_attach (segment_handle, (char *) mp->segment_name,
SSVM_SEGMENT_MEMFD, fds[n_fds++])) SSVM_SEGMENT_MEMFD, fds[n_fds++]))
return; goto failed;
if (mp->fd_flags & SESSION_FD_F_MQ_EVENTFD) if (mp->fd_flags & SESSION_FD_F_MQ_EVENTFD)
{ {
@ -161,11 +160,15 @@ vl_api_application_attach_reply_t_handler (vl_api_application_attach_reply_t *
{ {
if (vcl_segment_attach (segment_handle, (char *) mp->segment_name, if (vcl_segment_attach (segment_handle, (char *) mp->segment_name,
SSVM_SEGMENT_SHM, -1)) SSVM_SEGMENT_SHM, -1))
return; goto failed;
} }
vcm->app_index = clib_net_to_host_u32 (mp->app_index); vcm->app_index = clib_net_to_host_u32 (mp->app_index);
vcm->app_state = STATE_APP_ATTACHED; vcm->app_state = STATE_APP_ATTACHED;
return;
failed:
vcm->app_state = STATE_APP_FAILED;
} }
static void static void