mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	cleaner way to handle seq/idle checks for the peer
This commit is contained in:
		
							parent
							
								
									4382368b08
								
							
						
					
					
						commit
						38dcbb1e2f
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
					@ -290,8 +290,8 @@ func (p *peer) _handleIdle() {
 | 
				
			||||||
			break
 | 
								break
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if len(packets) > 0 {
 | 
					 | 
				
			||||||
	p.seq++
 | 
						p.seq++
 | 
				
			||||||
 | 
						if len(packets) > 0 {
 | 
				
			||||||
		p.bytesSent += uint64(size)
 | 
							p.bytesSent += uint64(size)
 | 
				
			||||||
		p.intf.out(packets)
 | 
							p.intf.out(packets)
 | 
				
			||||||
		p.max = p.queue.size
 | 
							p.max = p.queue.size
 | 
				
			||||||
| 
						 | 
					@ -304,7 +304,7 @@ func (p *peer) _handleIdle() {
 | 
				
			||||||
func (p *peer) dropFromQueue(from phony.Actor, seq uint64) {
 | 
					func (p *peer) dropFromQueue(from phony.Actor, seq uint64) {
 | 
				
			||||||
	p.Act(from, func() {
 | 
						p.Act(from, func() {
 | 
				
			||||||
		p.Act(nil, func() {
 | 
							p.Act(nil, func() {
 | 
				
			||||||
			if seq == p.seq && !p.idle {
 | 
								if seq == p.seq {
 | 
				
			||||||
				p.drop = true
 | 
									p.drop = true
 | 
				
			||||||
				p.max = p.queue.size + streamMsgSize
 | 
									p.max = p.queue.size + streamMsgSize
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue