Don't use lobby join method if server isn't probed yet when required
This commit is contained in:
@@ -21,6 +21,12 @@ pub async fn occupy(
|
|||||||
) -> Result<MethodResult, ()> {
|
) -> Result<MethodResult, ()> {
|
||||||
trace!(target: "lazymc", "Using lobby method to occupy joining client");
|
trace!(target: "lazymc", "Using lobby method to occupy joining client");
|
||||||
|
|
||||||
|
// Must be ready to lobby
|
||||||
|
if must_still_probe(&config, &server).await {
|
||||||
|
warn!(target: "lazymc", "Client connected but lobby is not ready, using next join method, probing not completed");
|
||||||
|
return Ok(MethodResult::Continue(inbound));
|
||||||
|
}
|
||||||
|
|
||||||
// Start lobby
|
// Start lobby
|
||||||
lobby::serve(client, client_info, inbound, config, server, inbound_queue).await?;
|
lobby::serve(client, client_info, inbound, config, server, inbound_queue).await?;
|
||||||
|
|
||||||
@@ -28,3 +34,13 @@ pub async fn occupy(
|
|||||||
|
|
||||||
Ok(MethodResult::Consumed)
|
Ok(MethodResult::Consumed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Check whether we still have to probe before we can use the lobby.
|
||||||
|
async fn must_still_probe(config: &Config, server: &Server) -> bool {
|
||||||
|
must_probe(config) && server.probed_join_game.lock().await.is_none()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Check whether we must have probed data.
|
||||||
|
fn must_probe(config: &Config) -> bool {
|
||||||
|
config.server.forge
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user