Skip to content

Commit

Permalink
Adopt the different congestion control defaults as in Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
Mallets committed Feb 12, 2025
1 parent 25b8499 commit c67b96f
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 23 deletions.
8 changes: 4 additions & 4 deletions include/zenoh-pico.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
#ifndef ZENOH_PICO_H
#define ZENOH_PICO_H

#define ZENOH_PICO "1.0.0.0"
#define ZENOH_PICO "1.2.1"
#define ZENOH_PICO_MAJOR 1
#define ZENOH_PICO_MINOR 0
#define ZENOH_PICO_PATCH 0
#define ZENOH_PICO_TWEAK 0
#define ZENOH_PICO_MINOR 2
#define ZENOH_PICO_PATCH 1
#define ZENOH_PICO_TWEAK

#include "zenoh-pico/api/constants.h"
#include "zenoh-pico/api/encoding.h"
Expand Down
8 changes: 6 additions & 2 deletions include/zenoh-pico/api/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,12 @@ typedef enum { Z_RELIABILITY_BEST_EFFORT = 1, Z_RELIABILITY_RELIABLE = 0 } z_rel
* Z_CONGESTION_CONTROL_DROP: Defines congestion control as ``DROP``. Messages are dropped in case
* of congestion control.
*/
typedef enum { Z_CONGESTION_CONTROL_BLOCK = 0, Z_CONGESTION_CONTROL_DROP = 1 } z_congestion_control_t;
#define Z_CONGESTION_CONTROL_DEFAULT Z_CONGESTION_CONTROL_BLOCK
typedef enum { Z_CONGESTION_CONTROL_BLOCK = 1, Z_CONGESTION_CONTROL_DROP = 0 } z_congestion_control_t;
#define Z_CONGESTION_CONTROL_DEFAULT Z_CONGESTION_CONTROL_DROP

inline z_congestion_control_t z_internal_congestion_control_default_push() { return Z_CONGESTION_CONTROL_DROP; }
inline z_congestion_control_t z_internal_congestion_control_default_request() { return Z_CONGESTION_CONTROL_BLOCK; }
inline z_congestion_control_t z_internal_congestion_control_default_response() { return Z_CONGESTION_CONTROL_BLOCK; }

/**
* Priority of Zenoh messages values.
Expand Down
8 changes: 4 additions & 4 deletions include/zenoh-pico/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#define INCLUDE_ZENOH_PICO_CONFIG_H

/*--- CMake generated config; pass values to CMake to change the following tokens ---*/
#define Z_FRAG_MAX_SIZE 4096
#define Z_BATCH_UNICAST_SIZE 2048
#define Z_FRAG_MAX_SIZE 0
#define Z_BATCH_UNICAST_SIZE 0
#define Z_BATCH_MULTICAST_SIZE 2048
#define Z_CONFIG_SOCKET_TIMEOUT 100

Expand All @@ -44,9 +44,9 @@
#define Z_FEATURE_ENCODING_VALUES 1
#define Z_FEATURE_TCP_NODELAY 1
#define Z_FEATURE_LOCAL_SUBSCRIBER 0
#define Z_FEATURE_PUBLISHER_SESSION_CHECK 1
#define Z_FEATURE_PUBLISHER_SESSION_CHECK
#define Z_FEATURE_BATCHING 1
#define Z_FEATURE_MATCHING 1
#define Z_FEATURE_MATCHING 0
#define Z_FEATURE_RX_CACHE 0
#define Z_FEATURE_AUTO_RECONNECT 1
// End of CMake generation
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zenoh-pico",
"version": "1.0.0.0",
"version": "1.2.1.",
"description": "The Eclipse Zenoh: Zero Overhead Pub/sub, Store/Query and Compute. It unifies data in motion, data in-use, data at rest and computations. It carefully blends traditional pub/sub with geo-distributed storages, queries and computations, while retaining a level of time and space efficiency that is well beyond any of the mainstream stacks. Zenoh-Pico is the implementation able to scale down to extremely constrainded devices and networks.",
"keywords": [
"pubsub",
Expand Down
22 changes: 11 additions & 11 deletions src/api/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ _Z_OWNED_FUNCTIONS_VALUE_NO_COPY_IMPL(_z_publisher_t, publisher, _z_publisher_ch
_z_publisher_drop)

void z_put_options_default(z_put_options_t *options) {
options->congestion_control = Z_CONGESTION_CONTROL_DEFAULT;
options->congestion_control = z_internal_congestion_control_default_push();
options->priority = Z_PRIORITY_DEFAULT;
options->encoding = NULL;
options->is_express = false;
Expand All @@ -868,7 +868,7 @@ void z_put_options_default(z_put_options_t *options) {
}

void z_delete_options_default(z_delete_options_t *options) {
options->congestion_control = Z_CONGESTION_CONTROL_DEFAULT;
options->congestion_control = z_internal_congestion_control_default_push();
options->is_express = false;
options->timestamp = NULL;
options->priority = Z_PRIORITY_DEFAULT;
Expand Down Expand Up @@ -936,7 +936,7 @@ z_result_t z_delete(const z_loaned_session_t *zs, const z_loaned_keyexpr_t *keye

void z_publisher_options_default(z_publisher_options_t *options) {
options->encoding = NULL;
options->congestion_control = Z_CONGESTION_CONTROL_DEFAULT;
options->congestion_control = z_internal_congestion_control_default_push();
options->priority = Z_PRIORITY_DEFAULT;
options->is_express = false;
#ifdef Z_FEATURE_UNSTABLE_API
Expand Down Expand Up @@ -1159,7 +1159,7 @@ _Z_OWNED_FUNCTIONS_VALUE_IMPL(_z_reply_t, reply, _z_reply_check, _z_reply_null,
void z_get_options_default(z_get_options_t *options) {
options->target = z_query_target_default();
options->consolidation = z_query_consolidation_default();
options->congestion_control = Z_CONGESTION_CONTROL_DEFAULT;
options->congestion_control = z_internal_congestion_control_default_request();
options->priority = Z_PRIORITY_DEFAULT;
options->is_express = false;
options->encoding = NULL;
Expand Down Expand Up @@ -1225,7 +1225,7 @@ void z_querier_get_options_default(z_querier_get_options_t *options) {
void z_querier_options_default(z_querier_options_t *options) {
options->target = z_query_target_default();
options->consolidation = z_query_consolidation_default();
options->congestion_control = Z_CONGESTION_CONTROL_DEFAULT;
options->congestion_control = z_internal_congestion_control_default_request();
options->priority = Z_PRIORITY_DEFAULT;
options->is_express = false;
options->timeout_ms = Z_GET_TIMEOUT_DEFAULT;
Expand Down Expand Up @@ -1467,7 +1467,7 @@ z_result_t z_undeclare_queryable(z_moved_queryable_t *queryable) {

void z_query_reply_options_default(z_query_reply_options_t *options) {
options->encoding = NULL;
options->congestion_control = Z_CONGESTION_CONTROL_DEFAULT;
options->congestion_control = z_internal_congestion_control_default_response();
options->priority = Z_PRIORITY_DEFAULT;
options->timestamp = NULL;
options->is_express = false;
Expand Down Expand Up @@ -1505,7 +1505,7 @@ z_result_t z_query_reply(const z_loaned_query_t *query, const z_loaned_keyexpr_t
}

void z_query_reply_del_options_default(z_query_reply_del_options_t *options) {
options->congestion_control = Z_CONGESTION_CONTROL_DEFAULT;
options->congestion_control = z_internal_congestion_control_default_response();
options->priority = Z_PRIORITY_DEFAULT;
options->timestamp = NULL;
options->is_express = false;
Expand Down Expand Up @@ -1730,8 +1730,8 @@ z_result_t zp_batch_flush(const z_loaned_session_t *zs) {
if (_Z_RC_IS_NULL(zs)) {
return _Z_ERR_SESSION_CLOSED;
}
// Send current batch
return _z_send_n_batch(session, Z_CONGESTION_CONTROL_DEFAULT);
// Send current batch without dropping
return _z_send_n_batch(session, Z_CONGESTION_CONTROL_BLOCK);
}

z_result_t zp_batch_stop(const z_loaned_session_t *zs) {
Expand All @@ -1740,8 +1740,8 @@ z_result_t zp_batch_stop(const z_loaned_session_t *zs) {
return _Z_ERR_SESSION_CLOSED;
}
_z_transport_stop_batching(&session->_tp);
// Send remaining batch
return _z_send_n_batch(session, Z_CONGESTION_CONTROL_DEFAULT);
// Send remaining batch without dropping
return _z_send_n_batch(session, Z_CONGESTION_CONTROL_BLOCK);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion zenohpico.pc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ prefix=/usr/local
Name: zenohpico
Description:
URL:
Version: 1.0.20241210dev
Version: 1.2.20250212dev
Cflags: -I${prefix}/include
Libs: -L${prefix}/lib -lzenohpico

0 comments on commit c67b96f

Please sign in to comment.