1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-13 15:23:49 +01:00

copilot review comments

This commit is contained in:
J. Nick Koston
2025-10-03 18:31:21 -05:00
parent 6ebdb61098
commit 60f67382be

View File

@@ -192,13 +192,16 @@ void BLEServer::add_client_(uint16_t conn_id) {
// Add if there's space // Add if there's space
if (this->client_count_ < USE_ESP32_BLE_MAX_CONNECTIONS) { if (this->client_count_ < USE_ESP32_BLE_MAX_CONNECTIONS) {
this->clients_[this->client_count_++] = conn_id; this->clients_[this->client_count_++] = conn_id;
} else {
// This should never happen since max clients is known at compile time
ESP_LOGE(TAG, "Client array full");
} }
} }
void BLEServer::remove_client_(uint16_t conn_id) { void BLEServer::remove_client_(uint16_t conn_id) {
int8_t index = this->find_client_index_(conn_id); int8_t index = this->find_client_index_(conn_id);
if (index >= 0) { if (index >= 0) {
// Replace with last element and decrement count // Replace with last element and decrement count (client order not preserved)
this->clients_[index] = this->clients_[--this->client_count_]; this->clients_[index] = this->clients_[--this->client_count_];
} }
} }