Skip to content

Commit f45bc81

Browse files
committed
wip
1 parent 967b72e commit f45bc81

File tree

4 files changed

+14
-21
lines changed

4 files changed

+14
-21
lines changed

include/zenoh-pico/net/primitives.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ z_result_t _z_write(_z_session_t *zn, const _z_keyexpr_t *keyexpr, const _z_byte
149149
const _z_encoding_t *encoding, const z_sample_kind_t kind, const z_congestion_control_t cong_ctrl,
150150
z_priority_t priority, bool is_express, const _z_timestamp_t *timestamp,
151151
const _z_bytes_t *attachment, z_reliability_t reliability, const _z_source_info_t *source_info,
152-
z_locality_t allowed_destination, bool *delivered_locally);
152+
z_locality_t allowed_destination);
153153
#endif
154154

155155
#if Z_FEATURE_SUBSCRIPTION == 1

src/api/api.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ z_result_t z_put(const z_loaned_session_t *zs, const z_loaned_keyexpr_t *keyexpr
990990
#endif
991991
ret = _z_write(_Z_RC_IN_VAL(zs), &keyexpr_aliased, payload_bytes, encoding, Z_SAMPLE_KIND_PUT,
992992
opt.congestion_control, opt.priority, opt.is_express, opt.timestamp, attachment_bytes, reliability,
993-
source_info, allowed_destination, NULL);
993+
source_info, allowed_destination);
994994

995995
#if Z_FEATURE_LOCAL_SUBSCRIBER == 1
996996
z_encoding_drop(opt.encoding);
@@ -1052,7 +1052,7 @@ z_result_t z_delete(const z_loaned_session_t *zs, const z_loaned_keyexpr_t *keye
10521052
#endif
10531053
ret = _z_write(_Z_RC_IN_VAL(zs), &keyexpr_aliased, &dummy_payload, NULL, Z_SAMPLE_KIND_DELETE,
10541054
opt.congestion_control, opt.priority, opt.is_express, opt.timestamp, &dummy_payload, reliability,
1055-
source_info, allowed_destination, NULL);
1055+
source_info, allowed_destination);
10561056

10571057
#if Z_FEATURE_LOCAL_SUBSCRIBER == 0
10581058
_z_timestamp_t local_timestamp = (opt.timestamp != NULL) ? *opt.timestamp : _z_timestamp_null();
@@ -1215,7 +1215,7 @@ z_result_t _z_publisher_put_impl(const z_loaned_publisher_t *pub, z_moved_bytes_
12151215
// Write value
12161216
ret = _z_write(session, &pub_keyexpr, payload_bytes, &encoding, Z_SAMPLE_KIND_PUT, pub->_congestion_control,
12171217
pub->_priority, pub->_is_express, opt.timestamp, attachment_bytes, reliability, source_info,
1218-
pub->_allowed_destination, NULL);
1218+
pub->_allowed_destination);
12191219
#if Z_FEATURE_LOCAL_SUBSCRIBER == 1
12201220
wrote = true;
12211221
#endif
@@ -1339,7 +1339,7 @@ z_result_t _z_publisher_delete_impl(const z_loaned_publisher_t *pub, const z_pub
13391339
!_z_write_filter_active(&pub->_filter)) {
13401340
ret = _z_write(session, &pub_keyexpr, &dummy_payload, NULL, Z_SAMPLE_KIND_DELETE, pub->_congestion_control,
13411341
pub->_priority, pub->_is_express, opt.timestamp, &dummy_payload, reliability, source_info,
1342-
pub->_allowed_destination, NULL);
1342+
pub->_allowed_destination);
13431343
}
13441344

13451345
#if Z_FEATURE_LOCAL_SUBSCRIBER == 0

src/net/primitives.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -198,22 +198,18 @@ z_result_t _z_write(_z_session_t *zn, const _z_keyexpr_t *keyexpr, const _z_byte
198198
const _z_encoding_t *encoding, z_sample_kind_t kind, z_congestion_control_t cong_ctrl,
199199
z_priority_t priority, bool is_express, const _z_timestamp_t *timestamp,
200200
const _z_bytes_t *attachment, z_reliability_t reliability, const _z_source_info_t *source_info,
201-
z_locality_t allowed_destination, bool *delivered_locally) {
201+
z_locality_t allowed_destination) {
202202
z_result_t ret = _Z_RES_OK;
203203
_z_qos_t qos = _z_n_qos_make(is_express, cong_ctrl == Z_CONGESTION_CONTROL_BLOCK, priority);
204-
bool local_delivery = false;
205204

206205
#if Z_FEATURE_LOCAL_SUBSCRIBER == 1
207206
if (_z_locality_allows_local(allowed_destination)) {
208-
local_delivery = _z_session_deliver_push_locally(zn, keyexpr, payload, encoding, kind, qos, timestamp,
209-
attachment, reliability, source_info, allowed_destination);
207+
_z_session_deliver_push_locally(zn, keyexpr, payload, encoding, kind, qos, timestamp, attachment, reliability,
208+
source_info, allowed_destination);
210209
}
211210
#endif
212211

213212
if (!_z_locality_allows_remote(allowed_destination)) {
214-
if (delivered_locally != NULL) {
215-
*delivered_locally = local_delivery;
216-
}
217213
return _Z_RES_OK;
218214
}
219215

@@ -233,9 +229,6 @@ z_result_t _z_write(_z_session_t *zn, const _z_keyexpr_t *keyexpr, const _z_byte
233229
_Z_ERROR_LOG(_Z_ERR_TRANSPORT_TX_FAILED);
234230
ret = _Z_ERR_TRANSPORT_TX_FAILED;
235231
}
236-
if (delivered_locally != NULL) {
237-
*delivered_locally = local_delivery;
238-
}
239232
// Freeing z_msg is unnecessary, as all of its components are aliased
240233
return ret;
241234
}

tests/z_local_loopback_test.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,9 @@ static void test_put_local_and_remote(void) {
434434
_z_source_info_t source_info = _z_source_info_null();
435435

436436
// Session-local only delivery should not touch transport
437-
z_result_t res = _z_write(&g_session, &keyexpr, &payload, &encoding, Z_SAMPLE_KIND_PUT, Z_CONGESTION_CONTROL_BLOCK,
438-
Z_PRIORITY_DEFAULT, false, &ts, NULL, Z_RELIABILITY_RELIABLE, &source_info,
439-
Z_LOCALITY_SESSION_LOCAL, NULL);
437+
z_result_t res =
438+
_z_write(&g_session, &keyexpr, &payload, &encoding, Z_SAMPLE_KIND_PUT, Z_CONGESTION_CONTROL_BLOCK,
439+
Z_PRIORITY_DEFAULT, false, &ts, NULL, Z_RELIABILITY_RELIABLE, &source_info, Z_LOCALITY_SESSION_LOCAL);
440440
assert(res == _Z_RES_OK);
441441
assert(atomic_load_explicit(&g_local_put_delivery_count, memory_order_relaxed) == 1);
442442
assert(atomic_load_explicit(&g_network_send_count, memory_order_relaxed) == 0);
@@ -445,7 +445,7 @@ static void test_put_local_and_remote(void) {
445445
atomic_store_explicit(&g_local_put_delivery_count, 0, memory_order_relaxed);
446446
atomic_store_explicit(&g_network_send_count, 0, memory_order_relaxed);
447447
res = _z_write(&g_session, &keyexpr, &payload, &encoding, Z_SAMPLE_KIND_PUT, Z_CONGESTION_CONTROL_BLOCK,
448-
Z_PRIORITY_DEFAULT, false, &ts, NULL, Z_RELIABILITY_RELIABLE, &source_info, Z_LOCALITY_ANY, NULL);
448+
Z_PRIORITY_DEFAULT, false, &ts, NULL, Z_RELIABILITY_RELIABLE, &source_info, Z_LOCALITY_ANY);
449449
assert(res == _Z_RES_OK);
450450
assert(atomic_load_explicit(&g_local_put_delivery_count, memory_order_relaxed) == 1);
451451
assert(atomic_load_explicit(&g_network_send_count, memory_order_relaxed) == 1);
@@ -617,7 +617,7 @@ static void test_put_remote_only_destination(void) {
617617

618618
z_result_t res =
619619
_z_write(&g_session, &keyexpr, &payload, &encoding, Z_SAMPLE_KIND_PUT, Z_CONGESTION_CONTROL_BLOCK,
620-
Z_PRIORITY_DEFAULT, false, &ts, NULL, Z_RELIABILITY_RELIABLE, &source_info, Z_LOCALITY_REMOTE, NULL);
620+
Z_PRIORITY_DEFAULT, false, &ts, NULL, Z_RELIABILITY_RELIABLE, &source_info, Z_LOCALITY_REMOTE);
621621
assert(res == _Z_RES_OK);
622622
assert(atomic_load_explicit(&g_local_put_delivery_count, memory_order_relaxed) == 0);
623623
assert(atomic_load_explicit(&g_network_send_count, memory_order_relaxed) == 1);
@@ -653,7 +653,7 @@ static void test_subscriber_remote_only_origin(void) {
653653

654654
z_result_t res =
655655
_z_write(&g_session, &keyexpr, &payload, &encoding, Z_SAMPLE_KIND_PUT, Z_CONGESTION_CONTROL_BLOCK,
656-
Z_PRIORITY_DEFAULT, false, &ts, NULL, Z_RELIABILITY_RELIABLE, &source_info, Z_LOCALITY_ANY, NULL);
656+
Z_PRIORITY_DEFAULT, false, &ts, NULL, Z_RELIABILITY_RELIABLE, &source_info, Z_LOCALITY_ANY);
657657
assert(res == _Z_RES_OK);
658658
assert(atomic_load_explicit(&g_local_put_delivery_count, memory_order_relaxed) == 0);
659659
assert(atomic_load_explicit(&g_network_send_count, memory_order_relaxed) == 1);

0 commit comments

Comments
 (0)