fix(server): RwLocks, amirite?

main
Skye 2 years ago
parent afa62d4ab6
commit 75931e5e88
Signed by: me
GPG Key ID: 0104BC05F41B77B8

@ -365,8 +365,10 @@ async fn accept_minecraft_connection(mut stream: TcpStream) -> Result<()> {
} }
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.server_address);
if let Some(sender) = ROUTING_MAP.read().await.get(&handshake.server_address) { let map = ROUTING_MAP.read().await;
let mut handle = ChannelHandle::new(sender, addr).await?; if let Some(sender) = map.get(&handshake.server_address).cloned() {
drop(map);
let mut handle: ChannelHandle = ChannelHandle::new(&sender, addr).await?;
let mut buf = vec![]; let mut buf = vec![];
handshake.send(&mut buf).await?; handshake.send(&mut buf).await?;
handle.send(buf)?; handle.send(buf)?;

Loading…
Cancel
Save