Merge pull request #431 from maxtox/patch-2

When receiving a number of messages, string might include old Data
This commit is contained in:
Henrik Ekblad
2016-05-05 17:44:57 +02:00
@@ -265,11 +265,13 @@ bool gatewayTransportAvailable()
//debug(PSTR("UDP packet available. Size:%d\n"), packet_size);
#if defined(MY_GATEWAY_ESP8266)
_ethernetServer.read(inputString[0].string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
inputString[0].string[packet_size] = 0;
debug(PSTR("UDP packet received: %s\n"), inputString[0].string);
return protocolParse(_ethernetMsg, inputString[0].string);
#else
_ethernetServer.read(inputString.string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
_w5100_spi_en(false);
inputString.string[packet_size] = 0;
debug(PSTR("UDP packet received: %s\n"), inputString.string);
return protocolParse(_ethernetMsg, inputString.string);
#endif