fix: of *course* it's FML

main
Skye 1 year ago
parent 9177e44adb
commit 4bc14d3b3f
Signed by: me
GPG Key ID: 0104BC05F41B77B8

@ -73,6 +73,15 @@ impl Handshake {
writer.write_all(&buf).await?;
Ok(())
}
fn normalized_address(&self) -> String {
if let Some(fml2_stripped) = self.server_address.strip_suffix("\0FML2\0") {
fml2_stripped.to_lowercase()
} else if let Some(fml_stripped) = self.server_address.strip_suffix("\0FML\0") {
fml_stripped.to_lowercase()
} else {
self.server_address.to_lowercase()
}
}
}
#[derive(Debug)]
@ -364,9 +373,9 @@ async fn accept_minecraft_connection(mut stream: TcpStream) -> Result<()> {
return Ok(());
}
let handshake = Handshake::new(&packet?).await?;
info!("Minecraft client {} is connecting to {}", addr, handshake.server_address);
info!("Minecraft client {} is connecting to {}", addr, handshake.normalized_address());
let map = ROUTING_MAP.read().await;
if let Some(sender) = map.get(&handshake.server_address.to_lowercase()).cloned() {
if let Some(sender) = map.get(&handshake.normalized_address()).cloned() {
drop(map);
let mut handle: ChannelHandle = ChannelHandle::new(&sender, addr).await?;
let mut buf = vec![];

Loading…
Cancel
Save