Add a poll time to wait properly

This commit is contained in:
Jack Garrard 2022-10-29 18:12:53 -07:00
parent 4ab6b56598
commit 477f1c9e7d
2 changed files with 7 additions and 1 deletions

View file

@ -74,6 +74,7 @@ class SocketClient : public SocketBase {
int maxBufSize = 100;
bool mIsFirstConnect = true;
bool mPacketQueueOpen = true;
int pollTime = 0;
bool mHasRecvUdp;

View file

@ -15,6 +15,11 @@
#include "types.h"
SocketClient::SocketClient(const char* name, sead::Heap* heap) : mHeap(heap), SocketBase(name) {
#if EMU
this->pollTime = 0;
#else
this->pollTime = -1;
#endif
mRecvThread = new al::AsyncFunctorThread("SocketRecvThread", al::FunctorV0M<SocketClient*, SocketThreadFunc>(this, &SocketClient::recvFunc), 0, 0x1000, {0});
mSendThread = new al::AsyncFunctorThread("SocketSendThread", al::FunctorV0M<SocketClient*, SocketThreadFunc>(this, &SocketClient::sendFunc), 0, 0x1000, {0});
@ -219,7 +224,7 @@ bool SocketClient::recv() {
pfds[1].revents = 0;
int result = nn::socket::Poll(pfds, fd_count, 0);
int result = nn::socket::Poll(pfds, fd_count, this->pollTime);
if (result == 0) {
return true;