Prevent Scanning issue after reconnected to AdhocServer, also Updated logging to showing the error code on sceNetAdhocctlScan

This commit is contained in:
ANR2ME 2020-10-21 08:43:34 +07:00
parent 40102787c8
commit 0363319f14
2 changed files with 5 additions and 3 deletions

View File

@ -1334,6 +1334,8 @@ int friendFinder(){
if (initNetwork(&product_code) == 0) {
networkInited = true;
INFO_LOG(SCENET, "FriendFinder: Network [RE]Initialized");
// At this point we are most-likely not in a Group within the Adhoc Server, so we should probably reset AdhocctlState
adhocctlState = ADHOCCTL_STATE_DISCONNECTED;
}
else {
networkInited = false;

View File

@ -1974,7 +1974,7 @@ int sceNetAdhocctlScan() {
ERROR_LOG(SCENET, "Socket error (%i) when sending", error);
adhocctlState = ADHOCCTL_STATE_DISCONNECTED;
//if (error == ECONNABORTED || error == ECONNRESET || error == ENOTCONN) return ERROR_NET_ADHOCCTL_NOT_INITIALIZED; // A case where it need to reconnect to AdhocServer
return ERROR_NET_ADHOCCTL_BUSY;
return hleLogError(SCENET, ERROR_NET_ADHOCCTL_BUSY, "busy");
}
else if (friendFinderRunning) {
AdhocctlRequest req = { OPCODE_SCAN, {0} };
@ -1989,7 +1989,7 @@ int sceNetAdhocctlScan() {
}
}
else if (adhocctlState == ADHOCCTL_STATE_SCANNING)
return ERROR_NET_ADHOCCTL_BUSY;
return hleLogError(SCENET, ERROR_NET_ADHOCCTL_BUSY, "busy");
// Already connected to a group. Should we fake a success?
// We need to notify the handler on success, even if it was faked. Using flag = 0/ADHOCCTL_EVENT_ERROR for error?
@ -2000,7 +2000,7 @@ int sceNetAdhocctlScan() {
}
// Library uninitialized
return ERROR_NET_ADHOCCTL_NOT_INITIALIZED;
return hleLogError(SCENET, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized");
}
int sceNetAdhocctlGetScanInfo(u32 sizeAddr, u32 bufAddr) {