mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	fix heap pop order
This commit is contained in:
		
							parent
							
								
									03b8af9f1a
								
							
						
					
					
						commit
						fd5f3ca764
					
				
					 1 changed files with 1 additions and 2 deletions
				
			
		| 
						 | 
					@ -20,11 +20,10 @@ import (
 | 
				
			||||||
const nonceWindow = time.Second
 | 
					const nonceWindow = time.Second
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// A heap of nonces, used with a map[nonce]time to allow out-of-order packets a little time to arrive without rejecting them
 | 
					// A heap of nonces, used with a map[nonce]time to allow out-of-order packets a little time to arrive without rejecting them
 | 
				
			||||||
// Less is backwards so the oldest node is the highest priority for Pop
 | 
					 | 
				
			||||||
type nonceHeap []crypto.BoxNonce
 | 
					type nonceHeap []crypto.BoxNonce
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (h nonceHeap) Len() int            { return len(h) }
 | 
					func (h nonceHeap) Len() int            { return len(h) }
 | 
				
			||||||
func (h nonceHeap) Less(i, j int) bool  { return h[i].Minus(&h[j]) > 0 }
 | 
					func (h nonceHeap) Less(i, j int) bool  { return h[i].Minus(&h[j]) < 0 }
 | 
				
			||||||
func (h nonceHeap) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
 | 
					func (h nonceHeap) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
 | 
				
			||||||
func (h *nonceHeap) Push(x interface{}) { *h = append(*h, x.(crypto.BoxNonce)) }
 | 
					func (h *nonceHeap) Push(x interface{}) { *h = append(*h, x.(crypto.BoxNonce)) }
 | 
				
			||||||
func (h *nonceHeap) Pop() interface{} {
 | 
					func (h *nonceHeap) Pop() interface{} {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue