[api] Move schedule_message_front_ out-of-line to avoid cold path bloat

schedule_message_front_ is only called from cold paths (on_shutdown,
check_keepalive_). Moving it out-of-line prevents add_item_front and
push_back from being inlined into those callers.
This commit is contained in:
J. Nick Koston
2026-04-01 10:09:20 -10:00
parent 475927e3c4
commit e2e2b7d699
2 changed files with 7 additions and 4 deletions
@@ -2072,6 +2072,11 @@ void APIConnection::on_fatal_error() {
this->flags_.remove = true;
}
bool APIConnection::schedule_message_front_(EntityBase *entity, uint8_t message_type, uint8_t estimated_size) {
this->deferred_batch_.add_item_front(entity, message_type, estimated_size);
return this->schedule_batch_();
}
bool APIConnection::send_message_smart_(EntityBase *entity, uint8_t message_type, uint8_t estimated_size,
uint8_t aux_data_index) {
if (this->should_send_immediately_(message_type) && this->helper_->can_write_without_blocking()) {
+2 -4
View File
@@ -797,10 +797,8 @@ class APIConnection final : public APIServerConnectionBase {
}
// Helper function to schedule a high priority message at the front of the batch
bool schedule_message_front_(EntityBase *entity, uint8_t message_type, uint8_t estimated_size) {
this->deferred_batch_.add_item_front(entity, message_type, estimated_size);
return this->schedule_batch_();
}
// Out-of-line: callers (on_shutdown, check_keepalive_) are cold paths
bool schedule_message_front_(EntityBase *entity, uint8_t message_type, uint8_t estimated_size);
// Helper function to log client messages with name and peername
void log_client_(int level, const LogString *message);