mirror of
https://github.com/eclipse/paho.mqtt-sn.embedded-c.git
synced 2025-12-13 15:36:51 +01:00
BugFix: 100% CPU
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace MQTTSNGW
|
||||
/*=================================
|
||||
* Starting prompt
|
||||
==================================*/
|
||||
#define GATEWAY_VERSION " * Version: 0.9.5"
|
||||
#define GATEWAY_VERSION " * Version: 0.9.6"
|
||||
|
||||
#define PAHO_COPYRIGHT0 " * MQTT-SN Transparent Gateway"
|
||||
#define PAHO_COPYRIGHT1 " * Part of Project Paho in Eclipse"
|
||||
|
||||
@@ -503,7 +503,8 @@ int Network::recv(uint8_t* buf, uint16_t len)
|
||||
}
|
||||
|
||||
_busy = true;
|
||||
loop: do
|
||||
loop:
|
||||
do
|
||||
{
|
||||
readBlockedOnWrite = false;
|
||||
readBlocked = false;
|
||||
|
||||
@@ -400,7 +400,7 @@ SerialPort::SerialPort()
|
||||
_tio.c_iflag = IGNBRK | IGNPAR;
|
||||
_tio.c_cflag = CS8 | CLOCAL | CRTSCTS;
|
||||
_tio.c_cc[VINTR] = 0;
|
||||
_tio.c_cc[VTIME] = 0;
|
||||
_tio.c_cc[VTIME] = 10; // 1 sec.
|
||||
_tio.c_cc[VMIN] = 1;
|
||||
_fd = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user