Skip to content

Commit

Permalink
feat: remove subscription ke limitation (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland authored Feb 22, 2024
1 parent 16e9eb3 commit 0f7779a
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/session/subscription.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,13 @@ _z_subscription_rc_t *_z_register_subscription(_z_session_t *zn, uint8_t is_loca
zp_mutex_lock(&zn->_mutex_inner);
#endif // Z_FEATURE_MULTI_THREAD == 1

_z_subscription_rc_list_t *subs = __unsafe_z_get_subscriptions_by_key(zn, is_local, s->_key);
if (subs == NULL) { // A subscription for this name does not yet exists
ret = (_z_subscription_rc_t *)zp_malloc(sizeof(_z_subscription_rc_t));
if (ret != NULL) {
*ret = _z_subscription_rc_new_from_val(*s);
if (is_local == _Z_RESOURCE_IS_LOCAL) {
zn->_local_subscriptions = _z_subscription_rc_list_push(zn->_local_subscriptions, ret);
} else {
zn->_remote_subscriptions = _z_subscription_rc_list_push(zn->_remote_subscriptions, ret);
}
ret = (_z_subscription_rc_t *)zp_malloc(sizeof(_z_subscription_rc_t));
if (ret != NULL) {
*ret = _z_subscription_rc_new_from_val(*s);
if (is_local == _Z_RESOURCE_IS_LOCAL) {
zn->_local_subscriptions = _z_subscription_rc_list_push(zn->_local_subscriptions, ret);
} else {
zn->_remote_subscriptions = _z_subscription_rc_list_push(zn->_remote_subscriptions, ret);
}
}

Expand Down

0 comments on commit 0f7779a

Please sign in to comment.