mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-29 00:25:00 +03:00
Use the TUN context snapshot in remaining launch-path reads (#9831)
Follow-up to #9830: audit of all TunModeItem.EnableTun usages found three more launch-path reads of the live mutable config where the behavior must agree with the context snapshot that generated the config: - CoreConfigClashService (mihomo custom config): the tun section was decided from the live config while the mihomo launch elevation uses the snapshot; a mid-reload toggle could produce a config containing tun launched without sudo, the same failure fixed in #9830. The tun state is now passed in as a snapshot. - CoreManager.LoadCore: the Windows RemoveTunDevice cleanup now checks the main/pre context snapshots. - CoreManager.WaitForProxyPort: preContext.AppConfig is a shared live reference; use preContext.IsTunEnabled instead. Reads that intentionally stay live: StatusBarViewModel (UI state source), CoreConfigContextBuilder (the snapshot capture point), GetPreSocksItem (called during snapshot construction, self-consistent), and AppManager.StatePort2 (transient mid-reload skew only, self-heals after reload).
This commit is contained in:
@@ -17,7 +17,7 @@ public static class CoreConfigHandler
|
||||
{
|
||||
result = node.CoreType switch
|
||||
{
|
||||
ECoreType.mihomo => await new CoreConfigClashService(config).GenerateClientCustomConfig(node, fileName),
|
||||
ECoreType.mihomo => await new CoreConfigClashService(config, context.IsTunEnabled).GenerateClientCustomConfig(node, fileName),
|
||||
_ => await GenerateClientCustomConfig(node, fileName)
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user