Speed and stability improved

This commit is contained in:
hsaturn
2021-03-27 01:40:21 +01:00
parent cb00d7f82a
commit 972759237c
2 changed files with 13 additions and 0 deletions

View File

@@ -311,6 +311,12 @@ using ClientFunction = void(*)(std::string& cmd, MqttClient* publish);
void loop()
{
static long count;
if (MqttClient::counter != count)
{
Serial << "# " << MqttClient::counter << endl;
count = MqttClient::counter;
}
for(auto it: brokers)
it.second->loop();

View File

@@ -522,9 +522,16 @@ void MqttMessage::incoming(char in_byte)
vheader = buffer.length();
if (size==0)
state = Complete;
else if (size > 500) // TODO magic
{
state = Error;
}
else
{
buffer.reserve(size);
state = VariableHeader;
}
}
break;
case VariableHeader:
case PayLoad: