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

Decode fails when interest id flag is set #392

Merged
merged 1 commit into from
Mar 28, 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
2 changes: 2 additions & 0 deletions include/zenoh-pico/protocol/definitions/declarations.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ typedef struct {
} _z_undecl_interest_t;
_z_undecl_interest_t _z_undecl_interest_null(void);

#define _Z_FLAG_INTEREST_ID (1 << 5)

typedef struct {
enum {
_Z_DECL_KEXPR,
Expand Down
6 changes: 5 additions & 1 deletion src/protocol/codec/declarations.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,13 @@ int8_t _z_undecl_interest_decode(_z_undecl_interest_t *decl, _z_zbuf_t *zbf, uin
return _z_undecl_trivial_decode(zbf, &decl->_ext_keyexpr, &decl->_id, header);
}
int8_t _z_declaration_decode(_z_declaration_t *decl, _z_zbuf_t *zbf) {
int8_t ret;
uint8_t header;
_Z_RETURN_IF_ERR(_z_uint8_decode(&header, zbf));
if (_Z_HAS_FLAG(header, _Z_FLAG_INTEREST_ID)) {
return _Z_ERR_MESSAGE_FLAG_UNEXPECTED;
}

int8_t ret;
switch (_Z_MID(header)) {
case _Z_DECL_KEXPR_MID: {
decl->_tag = _Z_DECL_KEXPR;
Expand Down
Loading