Refactor, cleanup status logic, extract join occupy logic into modules

This commit is contained in:
timvisee
2021-11-16 17:05:44 +01:00
parent 4510586169
commit b06f26b3e8
17 changed files with 656 additions and 451 deletions

30
src/join/forward.rs Normal file
View File

@@ -0,0 +1,30 @@
use std::sync::Arc;
use bytes::BytesMut;
use tokio::net::TcpStream;
use crate::config::*;
use crate::service;
use super::MethodResult;
/// Forward the client.
pub async fn occupy(
config: Arc<Config>,
inbound: TcpStream,
inbound_history: &mut BytesMut,
) -> Result<MethodResult, ()> {
trace!(target: "lazymc", "Using forward method to occupy joining client");
debug!(target: "lazymc", "Forwarding client to {:?}!", config.join.forward.address);
service::server::route_proxy_address_queue(
inbound,
config.join.forward.address,
inbound_history.clone(),
);
// TODO: do not consume, continue on proxy connect failure
Ok(MethodResult::Consumed)
}