mirror of
https://github.com/CraftyBoss/SuperMarioOdysseyOnline.git
synced 2024-11-21 18:55:16 +00:00
Add a poll time to wait properly
This commit is contained in:
parent
4ab6b56598
commit
477f1c9e7d
2 changed files with 7 additions and 1 deletions
|
@ -74,6 +74,7 @@ class SocketClient : public SocketBase {
|
||||||
int maxBufSize = 100;
|
int maxBufSize = 100;
|
||||||
bool mIsFirstConnect = true;
|
bool mIsFirstConnect = true;
|
||||||
bool mPacketQueueOpen = true;
|
bool mPacketQueueOpen = true;
|
||||||
|
int pollTime = 0;
|
||||||
|
|
||||||
|
|
||||||
bool mHasRecvUdp;
|
bool mHasRecvUdp;
|
||||||
|
|
|
@ -15,6 +15,11 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
SocketClient::SocketClient(const char* name, sead::Heap* heap) : mHeap(heap), SocketBase(name) {
|
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});
|
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});
|
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;
|
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) {
|
if (result == 0) {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue