mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	move where the queue size check before dropping would occur
This commit is contained in:
		
							parent
							
								
									62b9fab5f8
								
							
						
					
					
						commit
						527d443916
					
				
					 2 changed files with 1 additions and 5 deletions
				
			
		| 
						 | 
					@ -55,11 +55,6 @@ func (q *packetQueue) drop() bool {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// Drop the oldest packet from the worst stream
 | 
						// Drop the oldest packet from the worst stream
 | 
				
			||||||
	packet := worstStream.infos[0].packet
 | 
						packet := worstStream.infos[0].packet
 | 
				
			||||||
	if false && q.size-uint64(len(packet)) < streamMsgSize {
 | 
					 | 
				
			||||||
		// TODO something better
 | 
					 | 
				
			||||||
		// We don't want to drop *all* packets, so lets save 1 batch worth...
 | 
					 | 
				
			||||||
		return false
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	worstStream.infos = worstStream.infos[1:]
 | 
						worstStream.infos = worstStream.infos[1:]
 | 
				
			||||||
	worstStream.size -= uint64(len(packet))
 | 
						worstStream.size -= uint64(len(packet))
 | 
				
			||||||
	q.size -= uint64(len(packet))
 | 
						q.size -= uint64(len(packet))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -310,6 +310,7 @@ func (p *peer) dropFromQueue(from phony.Actor, seq uint64) {
 | 
				
			||||||
	p.Act(from, func() {
 | 
						p.Act(from, func() {
 | 
				
			||||||
		switch {
 | 
							switch {
 | 
				
			||||||
		case seq != p.seq:
 | 
							case seq != p.seq:
 | 
				
			||||||
 | 
								//case p.queue.size < streamMsgSize:
 | 
				
			||||||
		case p.queue.drop():
 | 
							case p.queue.drop():
 | 
				
			||||||
			p.core.log.Debugln("DEBUG dropped:", p.port, p.queue.size)
 | 
								p.core.log.Debugln("DEBUG dropped:", p.port, p.queue.size)
 | 
				
			||||||
			p.intf.notifyQueued(p.seq)
 | 
								p.intf.notifyQueued(p.seq)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue