shadowsocks / qtun

Yet another SIP003 plugin based on IETF-QUIC
121 stars 15 forks source link

Update client.rs #4

Closed dev4u closed 2 years ago

dev4u commented 2 years ago

Fix the issue that the connection creation fails when the network changes

zonyitoo commented 2 years ago

This will create a new UdpSocket for every accepted connections. Why do you think that it is the root cause?

dev4u commented 2 years ago

因为手机的网络环境发生变化的时候,之前建立的nat映射失效了。不rebind的话发不了数据。 当然,我也承认提交的代码比较粗糙,或许可以先检测网络环境是否有发生变化,再决定要不要rebind,这比较合乎该有的效果。

madeye commented 2 years ago

You should only do this when the connect() failed: https://github.com/shadowsocks/qtun/blob/master/src/client.rs#L116

dev4u commented 2 years ago

@zonyitoo 你替我看看这样修改还有没有问题?

dev4u commented 2 years ago

You should only do this when the connect() failed: https://github.com/shadowsocks/qtun/blob/master/src/client.rs#L116

已经按照你的建议做了修改。

madeye commented 2 years ago

Can you confirm your fix works now?

dev4u commented 2 years ago

Can you confirm your fix works now?

是的,这两天一直在我的手机移动网络下运行着。

madeye commented 2 years ago

https://github.com/shadowsocks/qtun/runs/5578803045?check_suite_focus=true