fix(server): RwLocks, amirite?
This commit is contained in:
		
							parent
							
								
									afa62d4ab6
								
							
						
					
					
						commit
						75931e5e88
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -365,8 +365,10 @@ async fn accept_minecraft_connection(mut stream: TcpStream) -> Result<()> {
 | 
			
		|||
    }
 | 
			
		||||
    let handshake = Handshake::new(&packet?).await?;
 | 
			
		||||
    info!("Minecraft client {} is connecting to {}", addr, handshake.server_address);
 | 
			
		||||
    if let Some(sender) = ROUTING_MAP.read().await.get(&handshake.server_address) {
 | 
			
		||||
        let mut handle = ChannelHandle::new(sender, addr).await?;
 | 
			
		||||
    let map = ROUTING_MAP.read().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![];
 | 
			
		||||
        handshake.send(&mut buf).await?;
 | 
			
		||||
        handle.send(buf)?;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue