mirror of
https://github.com/esphome/esphome.git
synced 2026-10-03 01:35:59 +00:00
[api] Mark send_message nodiscard so refused frames are never silent (#18293)
This commit is contained in:
@@ -166,7 +166,9 @@ void ZWaveProxy::process_uart_slow_() {
|
||||
// If this is a data frame, use frame length indicator + 2 (for SoF + checksum), else assume 1 for ACK/NAK/CAN
|
||||
this->outgoing_proto_msg_.data_len = this->buffer_[0] == ZWAVE_FRAME_TYPE_START ? this->buffer_[1] + 2 : 1;
|
||||
}
|
||||
this->api_connection_->send_message(this->outgoing_proto_msg_);
|
||||
if (!this->api_connection_->send_message(this->outgoing_proto_msg_)) {
|
||||
ESP_LOGV(TAG, "Frame dropped, TCP buffer full");
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (this->available());
|
||||
@@ -328,7 +330,9 @@ void ZWaveProxy::send_homeid_changed_msg_(api::APIConnection *conn) {
|
||||
msg.data_len = this->home_id_.size();
|
||||
if (conn != nullptr) {
|
||||
// Send to specific connection
|
||||
conn->send_message(msg);
|
||||
if (!conn->send_message(msg)) {
|
||||
API_LOG_MSG_DROPPED(TAG, "Home ID notification");
|
||||
}
|
||||
} else if (api::global_api_server != nullptr) {
|
||||
// We could add code to manage a second subscription type, but, since this message is
|
||||
// very infrequent and small, we simply send it to all clients
|
||||
@@ -483,7 +487,9 @@ void ZWaveProxy::parse_start_(uint8_t byte) {
|
||||
this->buffer_[0] = byte;
|
||||
this->outgoing_proto_msg_.data = this->buffer_.data();
|
||||
this->outgoing_proto_msg_.data_len = 1;
|
||||
this->api_connection_->send_message(this->outgoing_proto_msg_);
|
||||
if (!this->api_connection_->send_message(this->outgoing_proto_msg_)) {
|
||||
ESP_LOGV(TAG, "Frame dropped, TCP buffer full");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user