mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	don't fail if there's an error setting bbr, just log it and continue
This commit is contained in:
		
							parent
							
								
									8e22d7137a
								
							
						
					
					
						commit
						fb3430207c
					
				
					 1 changed files with 9 additions and 5 deletions
				
			
		| 
						 | 
					@ -19,10 +19,14 @@ func (t *tcp) tcpContext(network, address string, c syscall.RawConn) error {
 | 
				
			||||||
		bbr = unix.SetsockoptString(int(fd), unix.IPPROTO_TCP, unix.TCP_CONGESTION, "bbr")
 | 
							bbr = unix.SetsockoptString(int(fd), unix.IPPROTO_TCP, unix.TCP_CONGESTION, "bbr")
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch {
 | 
						// Log any errors
 | 
				
			||||||
	case bbr != nil:
 | 
						if bbr != nil {
 | 
				
			||||||
		return bbr
 | 
							t.link.core.log.Debugln("Failed to set tcp_congestion_control to bbr for socket, SetsockoptString error:", bbr)
 | 
				
			||||||
	default:
 | 
					 | 
				
			||||||
		return control
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if control != nil {
 | 
				
			||||||
 | 
							t.link.core.log.Debugln("Failed to set tcp_congestion_control to bbr for socket, Control error:", control)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Return nil because errors here are not considered fatal for the connection, it just means congestion control is suboptimal
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue