Skip to content

Commit

Permalink
fix: cong_ctrl not initialized in reply options default
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Jul 8, 2024
1 parent 8165b3f commit 2d69e68
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/zenoh-pico/protocol/definitions/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ typedef _z_qos_t _z_n_qos_t;
static inline _z_qos_t _z_n_qos_create(_Bool express, z_congestion_control_t congestion_control,
z_priority_t priority) {
_z_n_qos_t ret;
_Bool nodrop = congestion_control == Z_CONGESTION_CONTROL_DROP ? 0 : 1;
_Bool nodrop = (congestion_control == Z_CONGESTION_CONTROL_DROP ? false : true);
ret._val = (uint8_t)((express << 4) | (nodrop << 3) | priority);
return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1207,10 +1207,10 @@ int8_t z_undeclare_queryable(z_owned_queryable_t *queryable) {
void z_query_reply_options_default(z_query_reply_options_t *options) {
options->encoding = NULL;
options->priority = Z_PRIORITY_DEFAULT;
options->encoding = NULL;
options->timestamp = NULL;
options->is_express = false;
options->attachment = NULL;
options->congestion_control = Z_CONGESTION_CONTROL_DEFAULT;
}

int8_t z_query_reply(const z_loaned_query_t *query, const z_loaned_keyexpr_t *keyexpr, z_owned_bytes_t *payload,
Expand Down
5 changes: 2 additions & 3 deletions src/protocol/codec/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ int8_t _z_response_encode(_z_wbuf_t *wbf, const _z_n_msg_response_t *msg) {
_Z_RETURN_IF_ERR(_z_wbuf_write_bytes(wbf, msg->_ext_responder._zid.id, 0, zidlen));
_Z_RETURN_IF_ERR(_z_zsize_encode(wbf, msg->_ext_responder._eid));
}

switch (msg->_tag) {
case _Z_RESPONSE_BODY_REPLY: {
_Z_RETURN_IF_ERR(_z_reply_encode(wbf, &msg->_body._reply));
Expand All @@ -302,9 +301,9 @@ int8_t _z_response_encode(_z_wbuf_t *wbf, const _z_n_msg_response_t *msg) {
break;
}
}

return ret;
}

int8_t _z_response_decode_extension(_z_msg_ext_t *extension, void *ctx) {
int8_t ret = _Z_RES_OK;
_z_n_msg_response_t *msg = (_z_n_msg_response_t *)ctx;
Expand Down Expand Up @@ -550,4 +549,4 @@ int8_t _z_network_message_decode(_z_network_message_t *msg, _z_zbuf_t *zbf) {
default:
return _Z_ERR_MESSAGE_DESERIALIZATION_FAILED;
}
}
}

0 comments on commit 2d69e68

Please sign in to comment.