mirror of
				https://github.com/2dust/v2rayN.git
				synced 2025-10-31 04:22:51 +00:00 
			
		
		
		
	Resolve the StatePort when the other components call it.
				
					
				
			This commit is contained in:
		
							parent
							
								
									af3c1dc039
								
							
						
					
					
						commit
						74149b761f
					
				
					 1 changed files with 16 additions and 6 deletions
				
			
		|  | @ -11,14 +11,24 @@ namespace v2rayN.Handler | ||||||
| 
 | 
 | ||||||
|         public static LazyConfig Instance => _instance.Value; |         public static LazyConfig Instance => _instance.Value; | ||||||
| 
 | 
 | ||||||
|         private int _statePort; |         private int? _statePort; | ||||||
|         public int StatePort { get => _statePort; } |         public int StatePort | ||||||
|         private Job _processJob  = new(); |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 if (_statePort is null) | ||||||
|  |                 { | ||||||
|  |                     _statePort = Utils.GetFreePort(); | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 return _statePort.Value; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         private Job _processJob = new(); | ||||||
| 
 | 
 | ||||||
|         public LazyConfig() |         public LazyConfig() | ||||||
|         { |         { | ||||||
|             _statePort = Utils.GetFreePort(); |  | ||||||
| 
 |  | ||||||
|             SqliteHelper.Instance.CreateTable<SubItem>(); |             SqliteHelper.Instance.CreateTable<SubItem>(); | ||||||
|             SqliteHelper.Instance.CreateTable<ProfileItem>(); |             SqliteHelper.Instance.CreateTable<ProfileItem>(); | ||||||
|             SqliteHelper.Instance.CreateTable<ServerStatItem>(); |             SqliteHelper.Instance.CreateTable<ServerStatItem>(); | ||||||
|  | @ -68,7 +78,7 @@ namespace v2rayN.Handler | ||||||
|             } |             } | ||||||
|             return localPort; |             return localPort; | ||||||
|         } |         } | ||||||
|          | 
 | ||||||
|         public void AddProcess(IntPtr processHandle) |         public void AddProcess(IntPtr processHandle) | ||||||
|         { |         { | ||||||
|             _processJob.AddProcess(processHandle); |             _processJob.AddProcess(processHandle); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Minghao Hu
						Minghao Hu