main-channel-client: Set state before sending ping messages

It is not guaranteed that all the messages will be sent on a single
push call, unless this is done very early.
Although currently this function is called very early remove
this hidden assumption in the code.
"ping_id" is just incremented every time a message is sent to
client (in "main_channel_marshall_ping") so the formulae
"mcc->priv->ping_id - 2" was there to get the id of two messages
ago (the first message queued in this function) assuming all
messages were pushed at the time the formulae is used.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
This commit is contained in:
Frediano Ziglio 2019-11-14 09:15:08 +00:00
parent b934b828df
commit a6ccd2a309

View File

@ -263,12 +263,12 @@ void main_channel_client_start_net_test(MainChannelClient *mcc, int test_rate)
return;
}
mcc->priv->net_test_id = mcc->priv->ping_id + 1;
mcc->priv->net_test_stage = NET_TEST_STAGE_WARMUP;
main_channel_client_push_ping(mcc, NET_TEST_WARMUP_BYTES);
main_channel_client_push_ping(mcc, 0);
main_channel_client_push_ping(mcc, NET_TEST_BYTES);
mcc->priv->net_test_id = mcc->priv->ping_id - 2;
mcc->priv->net_test_stage = NET_TEST_STAGE_WARMUP;
}
static RedPipeItem *red_ping_item_new(int size)