mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-11-28 08:44:21 +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;
|
||||
#elif defined(__3DS__)
|
||||
int err;
|
||||
u64 poll_start = osGetTime();
|
||||
// seems like timeoutMs is never negative
|
||||
for (u64 i = poll_start; (i - poll_start) < (u64)timeoutMs; i = osGetTime()) {
|
||||
err = poll(pollFds, pollFdsCount, 0); // This is running for 14ms
|
||||
if (err) {
|
||||
break;
|
||||
if (timeoutMs > 0) {
|
||||
int err;
|
||||
u64 poll_start = osGetTime();
|
||||
for (u64 i = poll_start; (i - poll_start) < (u64)timeoutMs; i = osGetTime()) {
|
||||
err = poll(pollFds, pollFdsCount, 0); // This is running for 14ms
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
svcSleepThread(1000);
|
||||
}
|
||||
svcSleepThread(1000);
|
||||
return err;
|
||||
}
|
||||
else {
|
||||
return poll(pollFds, pollFdsCount, timeoutMs);
|
||||
}
|
||||
return err;
|
||||
#else
|
||||
return poll(pollFds, pollFdsCount, timeoutMs);
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user