mirror of
				https://github.com/2dust/v2rayN.git
				synced 2025-11-04 06:22:52 +00:00 
			
		
		
		
	Utils.GetFreePort() default port to be zero
This commit is contained in:
		
							parent
							
								
									b938538926
								
							
						
					
					
						commit
						f2c7cb4e43
					
				
					 2 changed files with 2 additions and 3 deletions
				
			
		| 
						 | 
					@ -427,11 +427,11 @@ public class Utils
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static int GetFreePort(int defaultPort = 9090)
 | 
					    public static int GetFreePort(int defaultPort = 0)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        try
 | 
					        try
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (!Utils.PortInUse(defaultPort))
 | 
					            if (!(defaultPort == 0 || Utils.PortInUse(defaultPort)))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                return defaultPort;
 | 
					                return defaultPort;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -825,7 +825,6 @@ public class CoreConfigSingboxService
 | 
				
			||||||
        try
 | 
					        try
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            endpoints.address = Utils.String2List(node.RequestHost);
 | 
					            endpoints.address = Utils.String2List(node.RequestHost);
 | 
				
			||||||
            // Utils.GetFreePort() 9090 ?
 | 
					 | 
				
			||||||
            endpoints.listen_port = Utils.GetFreePort();
 | 
					            endpoints.listen_port = Utils.GetFreePort();
 | 
				
			||||||
            endpoints.type = Global.ProtocolTypes[node.ConfigType];
 | 
					            endpoints.type = Global.ProtocolTypes[node.ConfigType];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue