mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	attempt to keep TCP listener alive if there's a temporary error (e.g. too many open files), just pause and retry later
This commit is contained in:
		
							parent
							
								
									9eb4981ac1
								
							
						
					
					
						commit
						1d1c6efa1f
					
				
					 2 changed files with 10 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -226,7 +226,13 @@ func (t *tcp) listener(l *TcpListener, listenaddr string) {
 | 
			
		|||
		sock, err := l.Listener.Accept()
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			t.links.core.log.Errorln("Failed to accept connection:", err)
 | 
			
		||||
			return
 | 
			
		||||
			select {
 | 
			
		||||
			case <-l.stop:
 | 
			
		||||
				return
 | 
			
		||||
			default:
 | 
			
		||||
			}
 | 
			
		||||
			time.Sleep(time.Second) // So we don't busy loop
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		t.waitgroup.Add(1)
 | 
			
		||||
		options := tcpOptions{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue