PharosVip 回应 sing-tun 审查:将 ICMP 转发改为有界异步队列
针对 wwqgtxx 提出的阻塞风险与重复加锁问题,PharosVip 表示已将 PrepareConnection 和数据包转发移入有界异步队列,并移除外层 s.icmpMu 锁,后续将继续跨平台测试。这是 mipstack 适配 PR 中的修订进展,尚不代表正式合并或发布。
作者原文@PharosVipAs a side note, I don't think the changes in the second commit are entirely sound. The
forwardICMPsection, in particular, appears to boost performance but introduces greater risk. In reality, theICMPForwarderHandlershould return as quickly as possible and avoid any blocking or long-running operations internally; clearly,PrepareConnectionoffers no guarantee against blocking.Furthermore, I don't quite understand the addition of
s.icmpMuthere;DirectRouteMappingis already thread-safe, so what is the purpose of wrapping it in an external lock?Thank you for pointing this out. I’ve moved PrepareConnection and packet forwarding to a bounded asynchronous queue.
I’ve also removed s.icmpMu. DirectRouteMapping uses its own synchronization, and the worker handles route cleanup when it exits.
I’ll spend some time conducting additional tests across platforms and share the results.