mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	[packet_transport] initialize packet data after flushing (#10686)
This commit is contained in:
		| @@ -270,6 +270,7 @@ void PacketTransport::add_binary_data_(uint8_t key, const char *id, bool data) { | |||||||
|   auto len = 1 + 1 + 1 + strlen(id); |   auto len = 1 + 1 + 1 + strlen(id); | ||||||
|   if (len + this->header_.size() + this->data_.size() > this->get_max_packet_size()) { |   if (len + this->header_.size() + this->data_.size() > this->get_max_packet_size()) { | ||||||
|     this->flush_(); |     this->flush_(); | ||||||
|  |     this->init_data_(); | ||||||
|   } |   } | ||||||
|   add(this->data_, key); |   add(this->data_, key); | ||||||
|   add(this->data_, (uint8_t) data); |   add(this->data_, (uint8_t) data); | ||||||
| @@ -284,6 +285,7 @@ void PacketTransport::add_data_(uint8_t key, const char *id, uint32_t data) { | |||||||
|   auto len = 4 + 1 + 1 + strlen(id); |   auto len = 4 + 1 + 1 + strlen(id); | ||||||
|   if (len + this->header_.size() + this->data_.size() > this->get_max_packet_size()) { |   if (len + this->header_.size() + this->data_.size() > this->get_max_packet_size()) { | ||||||
|     this->flush_(); |     this->flush_(); | ||||||
|  |     this->init_data_(); | ||||||
|   } |   } | ||||||
|   add(this->data_, key); |   add(this->data_, key); | ||||||
|   add(this->data_, data); |   add(this->data_, data); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user