make the server not send chunks redundantly when there aren't any to send
This commit is contained in:
		
							parent
							
								
									ea70c264fe
								
							
						
					
					
						commit
						e9f9e21bc2
					
				
					 1 changed files with 9 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -429,13 +429,15 @@ impl SessionLoop {
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ws.send(to_message(&Notify::Chunks {
 | 
			
		||||
            chunks: chunk_infos,
 | 
			
		||||
            has_more: !self.pending_images.is_empty()
 | 
			
		||||
                || self.viewport_chunks.clone().next().is_some(),
 | 
			
		||||
        }))
 | 
			
		||||
        .await?;
 | 
			
		||||
        ws.send(Message::Binary(packet)).await?;
 | 
			
		||||
        if !chunk_infos.is_empty() {
 | 
			
		||||
            ws.send(to_message(&Notify::Chunks {
 | 
			
		||||
                chunks: chunk_infos,
 | 
			
		||||
                has_more: !self.pending_images.is_empty()
 | 
			
		||||
                    || self.viewport_chunks.clone().next().is_some(),
 | 
			
		||||
            }))
 | 
			
		||||
            .await?;
 | 
			
		||||
            ws.send(Message::Binary(packet)).await?;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        Ok(())
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue