heiher / hev-socks5-tunnel

A high-performance tun2socks for Linux/Android/FreeBSD/macOS/iOS/WSL2 (IPv4/IPv6/TCP/UDP)
MIT License
860 stars 159 forks source link

Flutter Android ANR #162

Closed LondonX closed 4 weeks ago

LondonX commented 4 weeks ago

Hi, you made a good job on this repo.

I tried to make it run in Flutter Android App, when I call TProxyStopService() which calls native_stop_service in hev-jni.c, it makes Flutter App unable to response any input, that makes ANR alert.

When ANR happens, App can still rendering, updating screen, make other background progress.

It issue may be caused by some code in pthread_mutex_lock, as I comment all code in native_stop_service except hev_socks5_tunnel_quit ();, it seems works fine, but does it have some side-effect?

LondonX commented 4 weeks ago

Woo, I may solved this problem by my self, but I don't understand exactly how lol.

The ANR may caused by stopping a NOT-connected-TUN. I modify the codes about VpnService.Builder along with sockstun repo to make successful establishing the connect of tun, and after established, TProxyStopService() works without ANR, weird.

as I comment all code in native_stop_service except hev_socks5_tunnel_quit ();

This operation seem like causing a issue that makes tun not usable (RX/TX always 0 in ifconfig).