Skip to content

Commit

Permalink
fix: apply PR feedbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
wyfo committed Dec 4, 2024
1 parent 5490645 commit 1b36f8e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/protocol/codec/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,15 +434,15 @@ z_result_t _z_fragment_encode(_z_wbuf_t *wbf, uint8_t header, const _z_t_msg_fra
z_result_t ret = _Z_RES_OK;
_Z_DEBUG("Encoding _Z_TRANSPORT_FRAGMENT");
_Z_RETURN_IF_ERR(_z_zsize_encode(wbf, msg->_sn))
if (msg->first == true) {
if (msg->first) {
if (_Z_HAS_FLAG(header, _Z_FLAG_T_Z) == true) {
_Z_RETURN_IF_ERR(_z_uint8_encode(wbf, _Z_MSG_EXT_ID_FRAGMENT_FIRST | _Z_MSG_EXT_MORE(msg->drop)));
} else {
_Z_DEBUG("Attempted to serialize Start extension, but the header extension flag was unset");
ret |= _Z_ERR_MESSAGE_SERIALIZATION_FAILED;
}
}
if (msg->drop == true) {
if (msg->drop) {
if (_Z_HAS_FLAG(header, _Z_FLAG_T_Z) == true) {
_Z_RETURN_IF_ERR(_z_uint8_encode(wbf, _Z_MSG_EXT_ID_FRAGMENT_DROP));
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/protocol/definitions/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ _z_transport_message_t _z_t_msg_make_fragment(_z_zint_t sn, _z_slice_t payload,

msg._body._fragment._sn = sn;
msg._body._fragment._payload = payload;
if (first == true || drop == true) {
if (first || drop) {
_Z_SET_FLAG(msg._header, _Z_FLAG_T_Z);
}
msg._body._fragment.first = first;
Expand Down
4 changes: 2 additions & 2 deletions src/transport/multicast/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,13 @@ z_result_t _z_multicast_handle_transport_message(_z_transport_multicast_t *ztm,
}
// Handle fragment markers
if (_Z_PATCH_HAS_FRAGMENT_MARKERS(entry->_patch)) {
if (t_msg->_body._fragment.first == true) {
if (t_msg->_body._fragment.first) {
_z_wbuf_clear(dbuf);
} else if (_z_wbuf_len(dbuf) == 0) {
_Z_DEBUG("First fragment received without the first marker");
break;
}
if (t_msg->_body._fragment.drop == true) {
if (t_msg->_body._fragment.drop) {
_z_wbuf_clear(dbuf);
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/transport/unicast/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ z_result_t _z_unicast_handle_transport_message(_z_transport_unicast_t *ztu, _z_t
}
// Handle fragment markers
if (_Z_PATCH_HAS_FRAGMENT_MARKERS(ztu->_patch)) {
if (t_msg->_body._fragment.first == true) {
if (t_msg->_body._fragment.first) {
_z_wbuf_clear(dbuf);
} else if (_z_wbuf_len(dbuf) == 0) {
_Z_DEBUG("First fragment received without the start marker");
break;
}
if (t_msg->_body._fragment.drop == true) {
if (t_msg->_body._fragment.drop) {
_z_wbuf_clear(dbuf);
break;
}
Expand Down

0 comments on commit 1b36f8e

Please sign in to comment.