axmolengine / axmol

Axmol Engine – A Multi-platform Engine for Desktop, XBOX (UWP) and Mobile games. (A fork of Cocos2d-x-4.0)
https://axmol.dev
MIT License
923 stars 205 forks source link

Using HttpClient when there is no internet connection. #1289

Closed Yehsam23 closed 1 year ago

Yehsam23 commented 1 year ago
  1. After turning off the internet, open cpp-test -> Network Test -> HttpClientTest -> "Test Get."
  2. After turning on the internet, if you press "Test Get" again, you will notice that all subsequent connections will still fail.

When there is no internet connection, the first attempt to use HttpClient is as follows: HttpClient::getInstance()->send(request); This attempt will fail.

Later, when the internet connection is restored, using the same method to operate HttpClient will result in a perpetual inability to connect.

halx99 commented 1 year ago

I can't reproduce this issue, which device do you test on?

Yehsam23 commented 1 year ago

@halx99 I get the same result on both an Android physical device and an iOS simulator. The video is as follows.

https://github.com/axmolengine/axmol/assets/1954445/fc629efa-8996-4f59-a0a8-f5c82042f13a

halx99 commented 1 year ago

caused by the ipv6 global address always present by API getifaddrs even through the network off by user

I  [yasio]This libc has getifaddrs/freeifaddrs
2023-08-10 16:07:17.133 14540-32701 yasio                   org.axmol.cpp_tests                  I  [yasio]xxsocket::traverse_local_address: ip=[fe80::dca5:f0ff:fe72:eaa8]
2023-08-10 16:07:17.133 14540-32701 yasio                   org.axmol.cpp_tests                  I  [yasio]xxsocket::traverse_local_address: ip=[2409:815a:325a:944:dca5:f0ff:fe72:eaa8]
2023-08-10 16:07:17.133 14540-32701 yasio                   org.axmol.cpp_tests                  I  [yasio]xxsocket::traverse_local_address: ip=[fe80::bc3e:14ff:fe9a:1d11]
2023-08-10 16:07:17.133 14540-32701 yasio                   org.axmol.cpp_tests                  I  [yasio]xxsocket::traverse_local_address: ip=[fe80::9016:4aff:fe6f:4633]
2023-08-10 16:07:17.133 14540-32701 yasio                   org.axmol.cpp_tests                  I  [yasio]xxsocket::traverse_local_address: ip=[::1]
2023-08-10 16:07:17.133 14540-32701 yasio                   org.axmol.cpp_tests                  I  [yasio]xxsocket::traverse_local_address: ip=127.0.0.1
halx99 commented 1 year ago

This issue should be fixed by https://github.com/axmolengine/axmol/commit/1b27df66d61893ea785380f3920ddf6ed2d22443