mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Fix for api disconnect detection. (#2909)
Co-authored-by: Otto Winter <otto@otto-winter.com>
This commit is contained in:
		| @@ -105,6 +105,7 @@ void APIConnection::loop() { | |||||||
|       ESP_LOGW(TAG, "%s didn't respond to ping request in time. Disconnecting...", this->client_info_.c_str()); |       ESP_LOGW(TAG, "%s didn't respond to ping request in time. Disconnecting...", this->client_info_.c_str()); | ||||||
|     } |     } | ||||||
|   } else if (now - this->last_traffic_ > keepalive) { |   } else if (now - this->last_traffic_ > keepalive) { | ||||||
|  |     ESP_LOGVV(TAG, "Sending keepalive PING..."); | ||||||
|     this->sent_ping_ = true; |     this->sent_ping_ = true; | ||||||
|     this->send_ping_request(PingRequest()); |     this->send_ping_request(PingRequest()); | ||||||
|   } |   } | ||||||
| @@ -908,7 +909,7 @@ bool APIConnection::send_buffer(ProtoWriteBuffer buffer, uint32_t message_type) | |||||||
|     } |     } | ||||||
|     return false; |     return false; | ||||||
|   } |   } | ||||||
|   this->last_traffic_ = millis(); |   // Do not set last_traffic_ on send | ||||||
|   return true; |   return true; | ||||||
| } | } | ||||||
| void APIConnection::on_unauthenticated_access() { | void APIConnection::on_unauthenticated_access() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user