Speed and stability improved
This commit is contained in:
@@ -311,6 +311,12 @@ using ClientFunction = void(*)(std::string& cmd, MqttClient* publish);
|
|||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
|
static long count;
|
||||||
|
if (MqttClient::counter != count)
|
||||||
|
{
|
||||||
|
Serial << "# " << MqttClient::counter << endl;
|
||||||
|
count = MqttClient::counter;
|
||||||
|
}
|
||||||
for(auto it: brokers)
|
for(auto it: brokers)
|
||||||
it.second->loop();
|
it.second->loop();
|
||||||
|
|
||||||
|
|||||||
@@ -522,9 +522,16 @@ void MqttMessage::incoming(char in_byte)
|
|||||||
vheader = buffer.length();
|
vheader = buffer.length();
|
||||||
if (size==0)
|
if (size==0)
|
||||||
state = Complete;
|
state = Complete;
|
||||||
|
else if (size > 500) // TODO magic
|
||||||
|
{
|
||||||
|
state = Error;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
buffer.reserve(size);
|
||||||
state = VariableHeader;
|
state = VariableHeader;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case VariableHeader:
|
case VariableHeader:
|
||||||
case PayLoad:
|
case PayLoad:
|
||||||
|
|||||||
Reference in New Issue
Block a user