chen08209:Concord 主线修复切网后复用旧 DNS 连接的问题,尚未发版

chen08209 说明,Concord 的 network.update 原先只清缓存、不丢弃 DNS 上游连接,interfaceChanged 为 true 时也走同一路径,切网后的 DoH 查询可能复用不再响应的旧连接并等到超时。主线提交 269be55a 改为先丢弃连接再清缓存,尚未随版本发布。作者介绍的回归测试让上游每条连接仅应答一次,检查了 interfaceChanged 的两种取值。

作者原文

Thanks for the detailed analysis and the regression test in your fork; your diagnosis is right. Fixed in main by 269be55a (written separately rather than taken from the fork), not yet in a release.

network.update cleared the cached answers but kept the resolvers' upstream connections, and interfaceChanged: true reached the same path, so the next query after a switch could go out on a DNS-over-HTTPS connection to the old network that stays open without answering, until the exchange times out. A network change now drops those connections before it clears the cache, as mihomo's default-interface callback (resolver.ResetConnection) and sing-box's ResetNetwork do. The regression test serves DNS over HTTP from an upstream that answers once per connection and then stays silent, and checks both values of interfaceChanged.