client: emsure channel rampup after response

This commit is contained in:
Thomas Schoebel-Theuer 2023-02-03 16:58:17 +01:00 committed by Thomas Schoebel-Theuer
parent 74321eee3c
commit 1f0b969e2b
2 changed files with 10 additions and 1 deletions

View File

@ -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:
{

View File

@ -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];