BugFix: 100% CPU

This commit is contained in:
tomoaki
2016-12-07 22:45:18 +09:00
parent 4ebd92fc14
commit 64f7bbac1b
4 changed files with 10 additions and 4 deletions

View File

@@ -16,6 +16,7 @@
#include "MQTTSNGWBrokerRecvTask.h"
#include "MQTTSNGWClient.h"
#include <unistd.h>
using namespace std;
using namespace MQTTSNGW;
@@ -90,7 +91,11 @@ void BrokerRecvTask::run(void)
client = client->getNextClient();
}
if (maxSock > 0)
if (maxSock == 0)
{
usleep(500 * 1000);
}
else
{
/* Check sockets is ready to read */
int activity = select(maxSock + 1, &rset, 0, 0, &timeout);