Skip to content

Commit

Permalink
Fixing full buffer check in LinkWireless::send(...)
Browse files Browse the repository at this point in the history
  • Loading branch information
afska committed Sep 14, 2024
1 parent a11ed09 commit 22c997a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/LinkWireless.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ class LinkWireless {
return false;
}

if (!_canSend()) {
if (!_canAddNewMessage()) {
if (_author < 0)
lastError = BUFFER_IS_FULL;
return false;
Expand Down Expand Up @@ -733,13 +733,21 @@ class LinkWireless {
[[nodiscard]] bool _hasActiveAsyncCommand() { return asyncCommand.isActive; }

/**
* @brief Returns whether there's room for new outgoing messages or not.
* @brief Returns whether there's room for sending messages or not.
* \warning This is internal API!
*/
[[nodiscard]] bool _canSend() {
return !sessionState.outgoingMessages.isFull();
}

/**
* @brief Returns whether there's room for scheduling new messages or not.
* \warning This is internal API!
*/
[[nodiscard]] bool _canAddNewMessage() {
return !sessionState.newOutgoingMessages.isFull();
}

/**
* @brief Returns the number of pending outgoing messages.
* \warning This is internal API!
Expand Down

0 comments on commit 22c997a

Please sign in to comment.