Keep connection alive while waiting for initial sync

This commit is contained in:
Imbris 2021-03-14 17:11:44 +00:00
parent 72ca632a2c
commit 93e33eed25

View File

@ -244,6 +244,7 @@ impl Client {
ping_stream.send(PingMsg::Ping)?;
// Wait for initial sync
let mut ping_interval = tokio::time::interval(core::time::Duration::from_secs(1));
let (
state,
entity,
@ -255,7 +256,13 @@ impl Client {
recipe_book,
max_group_size,
client_timeout,
) = match register_stream.recv().await? {
) = match loop {
tokio::select! {
res = register_stream.recv() => break res?,
_ = ping_interval.tick() => ping_stream.send(PingMsg::Ping)?,
}
} {
ServerInit::GameSync {
entity_package,
time_of_day,