mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	remove switch doworker loop, start a dummy loop to respond to (unused) reconfiguration instead
This commit is contained in:
		
							parent
							
								
									998c76fd8c
								
							
						
					
					
						commit
						c573170886
					
				
					 1 changed files with 6 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -566,7 +566,12 @@ func (t *switchTable) getTable() lookupTable {
 | 
			
		|||
// Starts the switch worker
 | 
			
		||||
func (t *switchTable) start() error {
 | 
			
		||||
	t.core.log.Infoln("Starting switch")
 | 
			
		||||
	go t.doWorker()
 | 
			
		||||
	go func() {
 | 
			
		||||
		// TODO find a better way to handle reconfiguration... and have the switch do something with the new configuration
 | 
			
		||||
		for ch := range t.reconfigure {
 | 
			
		||||
			ch <- nil
 | 
			
		||||
		}
 | 
			
		||||
	}()
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -865,17 +870,6 @@ func (t *switchTable) _idleIn(port switchPort) {
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// The switch worker does routing lookups and sends packets to where they need to be
 | 
			
		||||
func (t *switchTable) doWorker() {
 | 
			
		||||
	for {
 | 
			
		||||
		//t.core.log.Debugf("Switch state: idle = %d, buffers = %d", len(idle), len(t.queues.bufs))
 | 
			
		||||
		select {
 | 
			
		||||
		case e := <-t.reconfigure:
 | 
			
		||||
			e <- nil
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Passed a function to call.
 | 
			
		||||
// This will send the function to t.admin and block until it finishes.
 | 
			
		||||
func (t *switchTable) doAdmin(f func()) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue