Skip to content

Commit

Permalink
Implement reply del receiving
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc committed Jul 8, 2024
1 parent 937f853 commit 8d4161f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/zenoh-pico/session/query.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ _z_pending_query_t *_z_get_pending_query_by_id(_z_session_t *zn, const _z_zint_t

int8_t _z_register_pending_query(_z_session_t *zn, _z_pending_query_t *pq);
int8_t _z_trigger_query_reply_partial(_z_session_t *zn, _z_zint_t reply_context, const _z_keyexpr_t keyexpr,
_z_msg_put_t *msg);
_z_msg_put_t *msg, z_sample_kind_t kind);
int8_t _z_trigger_query_reply_final(_z_session_t *zn, _z_zint_t id);
void _z_unregister_pending_query(_z_session_t *zn, _z_pending_query_t *pq);
void _z_flush_pending_queries(_z_session_t *zn);
Expand Down
4 changes: 2 additions & 2 deletions src/session/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ int8_t _z_register_pending_query(_z_session_t *zn, _z_pending_query_t *pen_qry)
}

int8_t _z_trigger_query_reply_partial(_z_session_t *zn, const _z_zint_t id, const _z_keyexpr_t keyexpr,
_z_msg_put_t *msg) {
_z_msg_put_t *msg, z_sample_kind_t kind) {
int8_t ret = _Z_RES_OK;

_zp_session_lock_mutex(zn);
Expand All @@ -113,7 +113,7 @@ int8_t _z_trigger_query_reply_partial(_z_session_t *zn, const _z_zint_t id, cons

// Build the reply
_z_reply_t reply = _z_reply_create(expanded_ke, Z_REPLY_TAG_DATA, zn->_local_zid, msg->_payload,
&msg->_commons._timestamp, &msg->_encoding, Z_SAMPLE_KIND_PUT, msg->_attachment);
&msg->_commons._timestamp, &msg->_encoding, kind, msg->_attachment);

// Verify if this is a newer reply, free the old one in case it is
if ((ret == _Z_RES_OK) && ((pen_qry->_consolidation == Z_CONSOLIDATION_MODE_LATEST) ||
Expand Down
7 changes: 2 additions & 5 deletions src/session/reply.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ int8_t _z_trigger_reply_partial(_z_session_t *zn, _z_zint_t id, _z_keyexpr_t key
// TODO check id to know where to dispatch

#if Z_FEATURE_QUERY == 1
if (reply->_body._is_put) {
ret = _z_trigger_query_reply_partial(zn, id, key, &reply->_body._body._put);
} else {
ret = _Z_ERR_GENERIC;
}
ret = _z_trigger_query_reply_partial(zn, id, key, &reply->_body._body._put,
(reply->_body._is_put ? Z_SAMPLE_KIND_PUT : Z_SAMPLE_KIND_DELETE));
#else
_ZP_UNUSED(zn);
_ZP_UNUSED(id);
Expand Down

0 comments on commit 8d4161f

Please sign in to comment.