mirror of
				https://github.com/2dust/v2rayN.git
				synced 2025-10-27 02:34:41 +00:00 
			
		
		
		
	fix bug
This commit is contained in:
		
							parent
							
								
									5878929430
								
							
						
					
					
						commit
						ed1a1f50af
					
				
					 1 changed files with 15 additions and 12 deletions
				
			
		|  | @ -32,20 +32,23 @@ namespace v2rayN.Handler | ||||||
| 
 | 
 | ||||||
|         public void LoadCore(bool isForce = false) |         public void LoadCore(bool isForce = false) | ||||||
|         { |         { | ||||||
|             List<AutoResetEvent> executingResetEvents; |             AutoResetEvent? loadResetEvent = default; | ||||||
|  |             List<AutoResetEvent>? executingResetEvents = default; | ||||||
|             lock (loadResetEvents) |             lock (loadResetEvents) | ||||||
|             { |             { | ||||||
|                 if (isForce && isLoading) |                 if (!isForce && isLoading) | ||||||
|                 { |                 { | ||||||
|                     var loadResetEvent = new AutoResetEvent(false); |                     loadResetEvent = new AutoResetEvent(false); | ||||||
|                     lock (loadResetEvents) loadResetEvents.Add(loadResetEvent); |                     loadResetEvents.Add(loadResetEvent); | ||||||
|                     loadResetEvent.WaitOne(); |                 } | ||||||
|                     return; |                 else | ||||||
|  |                 { | ||||||
|  |                     isLoading = true; | ||||||
|  |                     executingResetEvents = new(loadResetEvents); | ||||||
|  |                     loadResetEvents.Clear(); | ||||||
|                 }                               |                 }                               | ||||||
|                 isLoading = true; |  | ||||||
|                 executingResetEvents = new(loadResetEvents); |  | ||||||
|                 loadResetEvents.Clear();                |  | ||||||
|             } |             } | ||||||
|  |             if (loadResetEvent?.WaitOne() == true) return; | ||||||
|             var node = ConfigHandler.GetDefaultServer(_config); |             var node = ConfigHandler.GetDefaultServer(_config); | ||||||
|             string fileName = Utils.GetConfigPath(Global.CoreConfigFileName); |             string fileName = Utils.GetConfigPath(Global.CoreConfigFileName); | ||||||
|             var result = CoreConfigHandler.GenerateClientConfig(node!, fileName, out string msg, out string content); |             var result = CoreConfigHandler.GenerateClientConfig(node!, fileName, out string msg, out string content); | ||||||
|  | @ -57,7 +60,7 @@ namespace v2rayN.Handler | ||||||
|                 Utils.RemoveDeviceForPnputil(Utils.GetSingboxTunDeviceInstanceId(Global.DefaultSingboxTunDeviceName)); |                 Utils.RemoveDeviceForPnputil(Utils.GetSingboxTunDeviceInstanceId(Global.DefaultSingboxTunDeviceName)); | ||||||
|                 CoreStart(node); |                 CoreStart(node); | ||||||
|             } |             } | ||||||
|             executingResetEvents.ForEach(result => result.Set()); |             executingResetEvents?.ForEach(result => result.Set()); | ||||||
|             lock(loadResetEvents) |             lock(loadResetEvents) | ||||||
|             { |             { | ||||||
|                 if(loadResetEvents.Count > 0) |                 if(loadResetEvents.Count > 0) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 chao wan
						chao wan