Skip to content

Commit

Permalink
daemon: update beacon length calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
blocktrron committed Feb 5, 2024
1 parent 7a6a978 commit 3c957f6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,24 @@ int create_vendor_element_buf() {
int ret = information_sources[i].collect(&gbi.output.buf[gbi.output.len + 2], gbi.output.size - gbi.output.len - 2);
if (ret == 0) {
/* No Information available */
log_error("No Information available for id=%d name=%s\n", i, information_sources[i].name);
continue;
} else if (ret > 0xff) {
/* Too much Information */
log_error("Too much Information for id=%d name=%s\n", i, information_sources[i].name);
return -ENOMEM;
} else if (ret < 0) {
/* Error */
return ret;
}

/* Update Length of Field*/
*element_length = ret;
*element_length = (uint8_t)ret;

/* Update total Length */
gbi.output.len += ret + 2;

log_debug("Add Element to beacon id=%d name=%s element_length=%d total_length=%d\n", i, information_sources[i].name, ret, gbi.output.len);
}

/* Set Length */
Expand Down

0 comments on commit 3c957f6

Please sign in to comment.