From 1f0b969e2b2dd266de6aed6b5f238640b32b516f Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Fri, 3 Feb 2023 16:58:17 +0100 Subject: [PATCH] client: emsure channel rampup after response --- kernel/mars_client.c | 3 +++ kernel/mars_client.h | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/kernel/mars_client.c b/kernel/mars_client.c index b7f97e77..bb46f961 100644 --- a/kernel/mars_client.c +++ b/kernel/mars_client.c @@ -253,6 +253,7 @@ void _kill_bundle(struct client_bundle *bundle) MARS_DBG("\n"); _kill_thread(&bundle->sender, "sender"); _kill_all_channels(bundle); + bundle->bundle_state = CL_BUNDLE_INITIALIZED; } static @@ -294,6 +295,7 @@ struct client_channel *_get_channel(struct client_bundle *bundle, int min_channe } /* Use higher channels only when the first one is fully established */ if (max_channel > 1 && + bundle->bundle_state >= CL_BUNDLE_RESPONSE_GOT && (bundle->channel[0].ch_state < CL_CHANNEL_CONNECTED)) { max_channel = 1; min_channel = 0; @@ -670,6 +672,7 @@ int receiver_thread(void *data) status); goto done; } + output->bundle.bundle_state = CL_BUNDLE_RESPONSE_GOT; break; case CMD_CB: { diff --git a/kernel/mars_client.h b/kernel/mars_client.h index 421c465a..111c2992 100644 --- a/kernel/mars_client.h +++ b/kernel/mars_client.h @@ -94,12 +94,18 @@ struct client_channel { enum CL_CHANNEL_STATE ch_state; }; +enum CL_BUNDLE_STATE { + CL_BUNDLE_INITIALIZED, + CL_BUNDLE_RESPONSE_GOT, +}; + struct client_bundle { char *host; char *path; struct mars_tcp_params *params; int last_thread_nr; - int old_channel; + short old_channel; + enum CL_BUNDLE_STATE bundle_state; wait_queue_head_t sender_event; struct client_threadinfo sender; struct client_channel channel[MAX_CLIENT_CHANNELS];