From 26dc58bfa7548582151958ec9dab301367a22c51 Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Fri, 29 Mar 2019 14:08:45 -0400 Subject: [PATCH] Minor bug fixes Drop the session reader lock across vlib_process_suspend(...) calls. Fix the debug CLI command. Change-Id: Ic0266dda1fdfa90971f2cb935248941317c01205 Signed-off-by: Dave Barach --- src/vnet/session-apps/http_server.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/vnet/session-apps/http_server.c b/src/vnet/session-apps/http_server.c index b33a086f99a..11940e361b0 100644 --- a/src/vnet/session-apps/http_server.c +++ b/src/vnet/session-apps/http_server.c @@ -277,7 +277,10 @@ send_data (http_session_t * hs, u8 * data) /* Made any progress? */ if (actual_transfer <= 0) { + http_server_sessions_reader_unlock (); vlib_process_suspend (vm, delay); + http_server_sessions_reader_lock (); + /* 10s deadman timer */ if (vlib_time_now (vm) > last_sent_timer + 10.0) { @@ -770,6 +773,7 @@ http_server_create_command_fn (vlib_main_t * vm, vlib_cli_command_t * cmd) { http_server_main_t *hsm = &http_server_main; + unformat_input_t _line_input, *line_input = &_line_input; u64 seg_size; u8 *html; int rv; @@ -778,13 +782,19 @@ http_server_create_command_fn (vlib_main_t * vm, hsm->private_segment_size = 0; hsm->fifo_size = 0; hsm->is_static = 0; - while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) + + /* Get a line of input. */ + if (!unformat_user (input, unformat_line_input, line_input)) + goto start_server; + + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) { - if (unformat (input, "static")) + if (unformat (line_input, "static")) hsm->is_static = 1; - else if (unformat (input, "prealloc-fifos %d", &hsm->prealloc_fifos)) + else + if (unformat (line_input, "prealloc-fifos %d", &hsm->prealloc_fifos)) ; - else if (unformat (input, "private-segment-size %U", + else if (unformat (line_input, "private-segment-size %U", unformat_memory_size, &seg_size)) { if (seg_size >= 0x100000000ULL) @@ -795,14 +805,18 @@ http_server_create_command_fn (vlib_main_t * vm, } hsm->private_segment_size = seg_size; } - else if (unformat (input, "fifo-size %d", &hsm->fifo_size)) + else if (unformat (line_input, "fifo-size %d", &hsm->fifo_size)) hsm->fifo_size <<= 10; - else if (unformat (input, "uri %s", &hsm->uri)) + else if (unformat (line_input, "uri %s", &hsm->uri)) ; else return clib_error_return (0, "unknown input `%U'", - format_unformat_error, input); + format_unformat_error, line_input); } + unformat_free (line_input); + +start_server: + if (hsm->my_client_index != (u32) ~ 0) return clib_error_return (0, "test http server is already running"); -- 2.16.6