Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS/Network: Make name resolution asynchronous #8901

Merged
merged 1 commit into from Aug 29, 2021

Conversation

sepalani
Copy link
Contributor

@sepalani sepalani commented Jun 25, 2020

This PR try to fix games hanging while resolving domain names using gethostbyname and getaddrinfo.

I'm open to suggestion, especially regarding the way the asynchronous part should be done.

Ready to be reviewed.

@sepalani
Copy link
Contributor Author

sepalani commented Aug 2, 2021

Hm... Sounds like MSVC's std::future doesn't like classes without default constructor ><'.

Otherwise, I just rebased this PR and it fixes games hanging/stuttering while resolving domain name. It produces WARN logs when they occur:

57:36:397 Core\IOS\Network\IP\Top.cpp:681 I[IOS_NET]: IOCTL_SO_GETHOSTBYNAME Address: gpcm.gs.wiimmfi.de, BufferIn: (13579a80, 19), BufferOut: (13578060, 1120)
57:36:399 Core\IOS\Network\IP\Top.cpp:681 I[IOS_NET]: IOCTL_SO_GETHOSTBYNAME Address: gpsp.gs.wiimmfi.de, BufferIn: (13579bc0, 19), BufferOut: (13578060, 1120)
57:36:400 Core\IOS\Network\IP\Top.cpp:681 I[IOS_NET]: IOCTL_SO_GETHOSTBYNAME Address: gamestats.gs.wiimmfi.de, BufferIn: (13579d00, 24), BufferOut: (13578060, 1120)
57:36:400 Core\IOS\Network\IP\Top.cpp:681 I[IOS_NET]: IOCTL_SO_GETHOSTBYNAME Address: gamestats2.gs.wiimmfi.de, BufferIn: (13579e40, 25), BufferOut: (13578060, 1120)
57:36:794 Core\IOS\Network\IP\Top.cpp:681 I[IOS_NET]: IOCTL_SO_GETHOSTBYNAME Address: monhunter3wii.available.gs.wiimmfi.de, BufferIn: (13579f80, 38), BufferOut: (13578060, 1120)
57:36:794 Core\IOS\IOS.cpp:682 W[IOS]: Previous request to device /dev/net/ip/top blocked emulation for 393152 microseconds.
57:37:210 Core\IOS\Network\IP\Top.cpp:681 I[IOS_NET]: IOCTL_SO_GETHOSTBYNAME Address: monhunter3wii.natneg1.gs.wiimmfi.de, BufferIn: (1357a0c0, 36), BufferOut: (13578060, 1120)
57:37:210 Core\IOS\IOS.cpp:682 W[IOS]: Previous request to device /dev/net/ip/top blocked emulation for 415722 microseconds.
57:37:587 Core\IOS\Network\IP\Top.cpp:681 I[IOS_NET]: IOCTL_SO_GETHOSTBYNAME Address: monhunter3wii.natneg2.gs.wiimmfi.de, BufferIn: (1357a200, 36), BufferOut: (13578060, 1120)
57:37:587 Core\IOS\IOS.cpp:682 W[IOS]: Previous request to device /dev/net/ip/top blocked emulation for 376621 microseconds.
57:38:023 Core\IOS\Network\IP\Top.cpp:681 I[IOS_NET]: IOCTL_SO_GETHOSTBYNAME Address: monhunter3wii.natneg3.gs.wiimmfi.de, BufferIn: (1357a340, 36), BufferOut: (13578060, 1120)
57:38:023 Core\IOS\IOS.cpp:682 W[IOS]: Previous request to device /dev/net/ip/top blocked emulation for 435380 microseconds.
57:38:297 Core\IOS\Network\IP\Top.cpp:681 I[IOS_NET]: IOCTL_SO_GETHOSTBYNAME Address: monhunter3wii.master.gs.wiimmfi.de, BufferIn: (1357a480, 35), BufferOut: (13578060, 1120)
57:38:297 Core\IOS\IOS.cpp:682 W[IOS]: Previous request to device /dev/net/ip/top blocked emulation for 273515 microseconds.
57:38:576 Core\IOS\Network\IP\Top.cpp:681 I[IOS_NET]: IOCTL_SO_GETHOSTBYNAME Address: monhunter3wii.gamestats.gs.wiimmfi.de, BufferIn: (1357a5c0, 38), BufferOut: (13578060, 1120)
57:38:576 Core\IOS\IOS.cpp:682 W[IOS]: Previous request to device /dev/net/ip/top blocked emulation for 278547 microseconds.
57:39:002 Core\IOS\Network\IP\Top.cpp:681 I[IOS_NET]: IOCTL_SO_GETHOSTBYNAME Address: monhunter3wii.gamestats2.gs.wiimmfi.de, BufferIn: (1357a700, 39), BufferOut: (13578060, 1120)
57:39:002 Core\IOS\IOS.cpp:682 W[IOS]: Previous request to device /dev/net/ip/top blocked emulation for 425937 microseconds.
57:39:282 Core\IOS\Network\IP\Top.cpp:681 I[IOS_NET]: IOCTL_SO_GETHOSTBYNAME Address: monhunter3wii.ms16.gs.wiimmfi.de, BufferIn: (1357a840, 33), BufferOut: (13578060, 1120)
57:39:282 Core\IOS\IOS.cpp:682 W[IOS]: Previous request to device /dev/net/ip/top blocked emulation for 278689 microseconds.

It can be seen with online games like Monster Hunter 3 and Mario Kart Wii while connecting online and Dolphin's FPS limiter disabled.

@JMC47
Copy link
Contributor

JMC47 commented Aug 2, 2021

I can test a few games with this if you get MSVC going, I have some games I play online now.

@sepalani sepalani changed the title [WIP] IOS/Network: Make name resolution asynchronous IOS/Network: Make name resolution asynchronous Aug 2, 2021
@sepalani
Copy link
Contributor Author

sepalani commented Aug 2, 2021

@JMC47
Done. I added a workaround.

I removed the "WIP" from the PR title but left it as a draft since I'm not sure how to address the MSVC issue yet.

@JMC47
Copy link
Contributor

JMC47 commented Aug 2, 2021

Fixes the Lag on Connect in Inazuma Strikers series, Mario Kart Wii, and likely others.

Source/Core/Core/IOS/Network/IP/Top.h Show resolved Hide resolved
Source/Core/Core/IOS/Network/IP/Top.h Outdated Show resolved Hide resolved
Source/Core/Core/IOS/Network/IP/Top.h Outdated Show resolved Hide resolved
@sepalani sepalani force-pushed the dns-async branch 2 times, most recently from a05dce6 to f54dadb Compare August 4, 2021 07:54
@sepalani sepalani marked this pull request as ready for review August 4, 2021 08:23
@sepalani
Copy link
Contributor Author

sepalani commented Aug 4, 2021

@leoetlino
Done. It also gets rid of this MSVC issue altogether.

Source/Core/Core/IOS/Network/IP/Top.cpp Outdated Show resolved Hide resolved
Source/Core/Core/IOS/Network/IP/Top.h Outdated Show resolved Hide resolved
Source/Core/Core/IOS/Network/IP/Top.h Outdated Show resolved Hide resolved
@sepalani
Copy link
Contributor Author

sepalani commented Aug 4, 2021

@leoetlino
Done.

@JMC47
Copy link
Contributor

JMC47 commented Aug 4, 2021

LGTM

@Adamillo
Copy link

Adamillo commented Aug 4, 2021

LGTM too

@JMC47 JMC47 merged commit 006fc99 into dolphin-emu:master Aug 29, 2021
11 checks passed
@sepalani sepalani deleted the dns-async branch August 29, 2021 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants