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() 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();

View File

@@ -522,8 +522,15 @@ 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: