mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	Revert "force things to buffer in the switch if the best link is currently busy. note that other links can end up sending if they become non-idle for other reasons. this is a temporary workaround to packet reordering, until we can figure out a better solution"
This reverts commit 80ba24d512.
			
			
This commit is contained in:
		
							parent
							
								
									3571c437ac
								
							
						
					
					
						commit
						87658f83e9
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
					@ -677,10 +677,13 @@ func (t *switchTable) _handleIn(packet []byte, idle map[switchPort]struct{}) boo
 | 
				
			||||||
	ports := t.core.peers.getPorts()
 | 
						ports := t.core.peers.getPorts()
 | 
				
			||||||
	for _, cinfo := range closer {
 | 
						for _, cinfo := range closer {
 | 
				
			||||||
		to := ports[cinfo.elem.port]
 | 
							to := ports[cinfo.elem.port]
 | 
				
			||||||
 | 
							_, isIdle := idle[cinfo.elem.port]
 | 
				
			||||||
		var update bool
 | 
							var update bool
 | 
				
			||||||
		switch {
 | 
							switch {
 | 
				
			||||||
		case to == nil:
 | 
							case to == nil:
 | 
				
			||||||
			// no port was found, ignore it
 | 
								// no port was found, ignore it
 | 
				
			||||||
 | 
							case !isIdle:
 | 
				
			||||||
 | 
								// the port is busy, ignore it
 | 
				
			||||||
		case best == nil:
 | 
							case best == nil:
 | 
				
			||||||
			// this is the first idle port we've found, so select it until we find a
 | 
								// this is the first idle port we've found, so select it until we find a
 | 
				
			||||||
			// better candidate port to use instead
 | 
								// better candidate port to use instead
 | 
				
			||||||
| 
						 | 
					@ -710,9 +713,6 @@ func (t *switchTable) _handleIn(packet []byte, idle map[switchPort]struct{}) boo
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if best != nil {
 | 
						if best != nil {
 | 
				
			||||||
		// Send to the best idle next hop
 | 
							// Send to the best idle next hop
 | 
				
			||||||
		if _, isIdle := idle[best.elem.port]; !isIdle {
 | 
					 | 
				
			||||||
			return false
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		delete(idle, best.elem.port)
 | 
							delete(idle, best.elem.port)
 | 
				
			||||||
		ports[best.elem.port].sendPacketsFrom(t, [][]byte{packet})
 | 
							ports[best.elem.port].sendPacketsFrom(t, [][]byte{packet})
 | 
				
			||||||
		return true
 | 
							return true
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue