Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bad value used to set reliability flag #413

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions include/zenoh-pico/protocol/definitions/transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,12 @@ _z_transport_message_t _z_t_msg_make_open_syn(_z_zint_t lease, _z_zint_t initial
_z_transport_message_t _z_t_msg_make_open_ack(_z_zint_t lease, _z_zint_t initial_sn);
_z_transport_message_t _z_t_msg_make_close(uint8_t reason, _Bool link_only);
_z_transport_message_t _z_t_msg_make_keep_alive(void);
_z_transport_message_t _z_t_msg_make_frame(_z_zint_t sn, _z_network_message_vec_t messages, _Bool is_reliable);
_z_transport_message_t _z_t_msg_make_frame_header(_z_zint_t sn, _Bool is_reliable);
_z_transport_message_t _z_t_msg_make_fragment_header(_z_zint_t sn, _Bool is_reliable, _Bool is_last);
_z_transport_message_t _z_t_msg_make_fragment(_z_zint_t sn, _z_bytes_t messages, _Bool is_reliable, _Bool is_last);
_z_transport_message_t _z_t_msg_make_frame(_z_zint_t sn, _z_network_message_vec_t messages,
z_reliability_t reliability);
_z_transport_message_t _z_t_msg_make_frame_header(_z_zint_t sn, z_reliability_t reliability);
_z_transport_message_t _z_t_msg_make_fragment_header(_z_zint_t sn, z_reliability_t reliability, _Bool is_last);
_z_transport_message_t _z_t_msg_make_fragment(_z_zint_t sn, _z_bytes_t messages, z_reliability_t reliability,
_Bool is_last);

/*------------------ Copy ------------------*/
void _z_t_msg_copy(_z_transport_message_t *clone, _z_transport_message_t *msg);
Expand Down
18 changes: 10 additions & 8 deletions src/protocol/definitions/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,13 @@ _z_transport_message_t _z_t_msg_make_keep_alive(void) {
return msg;
}

_z_transport_message_t _z_t_msg_make_frame(_z_zint_t sn, _z_network_message_vec_t messages, _Bool is_reliable) {
_z_transport_message_t _z_t_msg_make_frame(_z_zint_t sn, _z_network_message_vec_t messages,
z_reliability_t reliability) {
_z_transport_message_t msg;
msg._header = _Z_MID_T_FRAME;

msg._body._frame._sn = sn;
if (is_reliable == true) {
if (reliability == Z_RELIABILITY_RELIABLE) {
_Z_SET_FLAG(msg._header, _Z_FLAG_T_FRAME_R);
}

Expand All @@ -218,12 +219,12 @@ _z_transport_message_t _z_t_msg_make_frame(_z_zint_t sn, _z_network_message_vec_
}

/*------------------ Frame Message ------------------*/
_z_transport_message_t _z_t_msg_make_frame_header(_z_zint_t sn, _Bool is_reliable) {
_z_transport_message_t _z_t_msg_make_frame_header(_z_zint_t sn, z_reliability_t reliability) {
_z_transport_message_t msg;
msg._header = _Z_MID_T_FRAME;

msg._body._frame._sn = sn;
if (is_reliable == true) {
if (reliability == Z_RELIABILITY_RELIABLE) {
_Z_SET_FLAG(msg._header, _Z_FLAG_T_FRAME_R);
}

Expand All @@ -233,16 +234,17 @@ _z_transport_message_t _z_t_msg_make_frame_header(_z_zint_t sn, _Bool is_reliabl
}

/*------------------ Fragment Message ------------------*/
_z_transport_message_t _z_t_msg_make_fragment_header(_z_zint_t sn, _Bool is_reliable, _Bool is_last) {
return _z_t_msg_make_fragment(sn, _z_bytes_empty(), is_reliable, is_last);
_z_transport_message_t _z_t_msg_make_fragment_header(_z_zint_t sn, z_reliability_t reliability, _Bool is_last) {
return _z_t_msg_make_fragment(sn, _z_bytes_empty(), reliability, is_last);
}
_z_transport_message_t _z_t_msg_make_fragment(_z_zint_t sn, _z_bytes_t payload, _Bool is_reliable, _Bool is_last) {
_z_transport_message_t _z_t_msg_make_fragment(_z_zint_t sn, _z_bytes_t payload, z_reliability_t reliability,
_Bool is_last) {
_z_transport_message_t msg;
msg._header = _Z_MID_T_FRAGMENT;
if (is_last == false) {
_Z_SET_FLAG(msg._header, _Z_FLAG_T_FRAGMENT_M);
}
if (is_reliable == true) {
if (reliability == Z_RELIABILITY_RELIABLE) {
_Z_SET_FLAG(msg._header, _Z_FLAG_T_FRAGMENT_R);
}

Expand Down
Loading