mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-13 01:29:41 +01:00
Do UPnP stuff on it's own thread to prevent causing stutters/lags during multiplayer game due to blocking socket behavior on miniUPnP
This commit is contained in:
1 parent
596fad3f42
commit
bd36fdda0e
5 files changed
+130
-21
No files matched your search
+6
-13
@@ -126,13 +126,10 @@ void __NetInit() {
|
||||
char tmpmac[18];
|
||||
SceNetEtherAddr mac;
|
||||
getLocalMac(&mac);
|
||||
INFO_LOG(SCENET, "LocalHost IP will be %s [MAC: %s]", inet_ntoa(((sockaddr_in*)&LocalhostIP)->sin_addr), mac2str(&mac, tmpmac));
|
||||
|
||||
// Only initialize when UPnP is enabled since it takes a few seconds to detect UPnP device (may affect people who don't have UPnP device)
|
||||
if (g_Config.bEnableUPnP) {
|
||||
// TODO: May be we should initialize & cleanup somewhere else than here for PortManager to be used as general purpose for whatever port forwarding PPSSPP needed
|
||||
g_PortManager.Initialize();
|
||||
}
|
||||
INFO_LOG(SCENET, "LocalHost IP will be %s [%s]", inet_ntoa(((sockaddr_in*)&LocalhostIP)->sin_addr), mac2str(&mac, tmpmac));
|
||||
|
||||
// TODO: May be we should initialize & cleanup somewhere else than here for PortManager to be used as general purpose for whatever port forwarding PPSSPP needed
|
||||
__UPnPInit();
|
||||
|
||||
__ResetInitNetLib();
|
||||
}
|
||||
@@ -140,15 +137,11 @@ void __NetInit() {
|
||||
void __NetShutdown() {
|
||||
// Network Cleanup
|
||||
Net_Term();
|
||||
|
||||
|
||||
__ResetInitNetLib();
|
||||
|
||||
// Since PortManager supposed to be general purpose for whatever port forwarding PPSSPP needed, may be we shouldn't clear & restore ports in here? it will be cleared and restored by PortManager's destructor when exiting PPSSPP anyway
|
||||
if (g_PortManager.GetInitState() == UPNP_INITSTATE_DONE) {
|
||||
g_PortManager.Clear();
|
||||
g_PortManager.Restore();
|
||||
g_PortManager.Terminate();
|
||||
}
|
||||
__UPnPShutdown();
|
||||
}
|
||||
|
||||
static void __UpdateApctlHandlers(int oldState, int newState, int flag, int error) {
|
||||
|
||||
Reference in new issue
Block a user