Skip to content

Commit

Permalink
Use NoteResetRequired instead of NoteReset when binary receive fails. (
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenroche5 authored Oct 5, 2023
1 parent e59cf1b commit ac5d3f5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions n_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,19 +406,19 @@ const char * NoteBinaryStoreReceive(uint8_t *buffer, uint32_t bufLen,

// Ensure transaction was successful
if (err) {
// Reset when a problem is detected, otherwise `note-c`
// will attempt to allocate memory to receive the response.
_Reset();
// Queue a reset when a problem is detected, otherwise `note-c` will
// attempt to allocate memory to receive the response.
NoteResetRequired();
return ERRSTR(err, c_err);
}

// Check buffer overflow condition
if (available) {
const char *err = ERRSTR("unexpected data available", c_err);
NOTE_C_LOG_ERROR(err);
// Reset when a problem is detected, otherwise `note-c`
// will attempt to allocate memory to receive the response.
_Reset();
// Queue a reset when a problem is detected, otherwise `note-c` will
// attempt to allocate memory to receive the response.
NoteResetRequired();
return err;
}

Expand All @@ -434,9 +434,9 @@ const char * NoteBinaryStoreReceive(uint8_t *buffer, uint32_t bufLen,
if (decodedLen != decLen) {
const char *err = ERRSTR("length mismatch after decoding", c_err);
NOTE_C_LOG_ERROR(err);
// Reset when a problem is detected, otherwise `note-c`
// will attempt to allocate memory to receive the response.
_Reset();
// Queue a reset when a problem is detected, otherwise `note-c` will
// attempt to allocate memory to receive the response.
NoteResetRequired();
return err;
}

Expand Down

0 comments on commit ac5d3f5

Please sign in to comment.