mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-12-03 11:41:29 +00:00
Fix pollSockets() with timeout 0 on 3DS
This commit is contained in:
1 parent
2804982d91
commit
e6b1aaf0b8
1 file changed
+13
-9
+13
-9
@@ -149,17 +149,21 @@ int pollSockets(struct pollfd* pollFds, int pollFdsCount, int timeoutMs) {
|
|||||||
|
|
||||||
return err;
|
return err;
|
||||||
#elif defined(__3DS__)
|
#elif defined(__3DS__)
|
||||||
int err;
|
if (timeoutMs > 0) {
|
||||||
u64 poll_start = osGetTime();
|
int err;
|
||||||
// seems like timeoutMs is never negative
|
u64 poll_start = osGetTime();
|
||||||
for (u64 i = poll_start; (i - poll_start) < (u64)timeoutMs; i = osGetTime()) {
|
for (u64 i = poll_start; (i - poll_start) < (u64)timeoutMs; i = osGetTime()) {
|
||||||
err = poll(pollFds, pollFdsCount, 0); // This is running for 14ms
|
err = poll(pollFds, pollFdsCount, 0); // This is running for 14ms
|
||||||
if (err) {
|
if (err) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
svcSleepThread(1000);
|
||||||
}
|
}
|
||||||
svcSleepThread(1000);
|
return err;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return poll(pollFds, pollFdsCount, timeoutMs);
|
||||||
}
|
}
|
||||||
return err;
|
|
||||||
#else
|
#else
|
||||||
return poll(pollFds, pollFdsCount, timeoutMs);
|
return poll(pollFds, pollFdsCount, timeoutMs);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in new issue
Block a user