X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvcl%2Fvppcom.c;h=6b690e5d1d0de3fa9cc1e81a374ebd1e392f0c46;hb=6017ff0dd7a27c062d0ad4687bfc70a69747ac55;hp=186b08468fdfc3b6690c56f5c1e796f727c50683;hpb=f49cf470c583507fa1b5b841887107071701ef5e;p=vpp.git diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 186b08468fd..6b690e5d1d0 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -749,6 +749,17 @@ vcl_session_cleanup_handler (vcl_worker_t * wrk, void *data) return; } + if (msg->type == SESSION_CLEANUP_TRANSPORT) + { + /* Transport was cleaned up before we confirmed close. Probably the + * app is still waiting for some data that cannot be delivered. + * Confirm close to make sure everything is cleaned up */ + if (session->session_state == STATE_VPP_CLOSING) + vcl_session_cleanup (wrk, session, vcl_session_handle (session), + 1 /* do_disconnect */ ); + return; + } + vcl_session_table_del_vpp_handle (wrk, msg->handle); /* Should not happen. App did not close the connection so don't free it. */ if (session->session_state != STATE_CLOSED) @@ -1211,8 +1222,8 @@ vppcom_app_create (char *app_name) void vppcom_app_destroy (void) { + vcl_worker_t *wrk, *current_wrk; struct dlmallinfo mi; - vcl_worker_t *wrk; mspace heap; if (!pool_elts (vcm->workers)) @@ -1220,16 +1231,20 @@ vppcom_app_destroy (void) vcl_evt (VCL_EVT_DETACH, vcm); - vcl_send_app_detach (vcl_worker_get_current ()); + current_wrk = vcl_worker_get_current (); /* *INDENT-OFF* */ pool_foreach (wrk, vcm->workers, ({ - vcl_worker_cleanup (wrk, 0 /* notify vpp */ ); + if (current_wrk != wrk) + vcl_worker_cleanup (wrk, 0 /* notify vpp */ ); })); /* *INDENT-ON* */ + vcl_send_app_detach (current_wrk); + vppcom_disconnect_from_vpp (); + vcl_worker_cleanup (current_wrk, 0 /* notify vpp */ ); + vcl_elog_stop (vcm); - vl_client_disconnect_from_vlib (); /* * Free the heap and fix vcm @@ -2399,12 +2414,12 @@ vppcom_select (int n_bits, vcl_si_set * read_map, vcl_si_set * write_map, clib_bitmap_foreach (sid, wrk->wr_bitmap, ({ if (!(session = vcl_session_get (wrk, sid))) { - if (except_map && sid < minbits) - clib_bitmap_set_no_check (except_map, sid, 1); - continue; + clib_bitmap_set_no_check ((uword*)write_map, sid, 1); + bits_set++; + continue; } - if (vcl_session_write_ready (session) > 0) + if (vcl_session_write_ready (session)) { clib_bitmap_set_no_check ((uword*)write_map, sid, 1); bits_set++; @@ -2420,12 +2435,12 @@ check_rd: clib_bitmap_foreach (sid, wrk->rd_bitmap, ({ if (!(session = vcl_session_get (wrk, sid))) { - if (except_map && sid < minbits) - clib_bitmap_set_no_check (except_map, sid, 1); - continue; + clib_bitmap_set_no_check ((uword*)read_map, sid, 1); + bits_set++; + continue; } - if (vcl_session_read_ready (session) > 0) + if (vcl_session_read_ready (session)) { clib_bitmap_set_no_check ((uword*)read_map, sid, 1); bits_set++; @@ -3815,6 +3830,12 @@ vppcom_worker_unregister (void) vcl_set_worker_index (~0); } +void +vppcom_worker_index_set (int index) +{ + vcl_set_worker_index (index); +} + int vppcom_worker_index (void) {