fix: of *course* it's FML
This commit is contained in:
parent
9177e44adb
commit
4bc14d3b3f
1 changed files with 11 additions and 2 deletions
|
@ -73,6 +73,15 @@ impl Handshake {
|
||||||
writer.write_all(&buf).await?;
|
writer.write_all(&buf).await?;
|
||||||
Ok(())
|
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)]
|
#[derive(Debug)]
|
||||||
|
@ -364,9 +373,9 @@ async fn accept_minecraft_connection(mut stream: TcpStream) -> Result<()> {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
let handshake = Handshake::new(&packet?).await?;
|
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;
|
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);
|
drop(map);
|
||||||
let mut handle: ChannelHandle = ChannelHandle::new(&sender, addr).await?;
|
let mut handle: ChannelHandle = ChannelHandle::new(&sender, addr).await?;
|
||||||
let mut buf = vec![];
|
let mut buf = vec![];
|
||||||
|
|
Loading…
Reference in a new issue