asterism-zenoh 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -2
- data/README.md +9 -4
- data/ext/asterism_zenoh/zenoh.c +34 -5
- data/lib/asterism/zenoh/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8dab0299ce74089f6125a49c9e782f363913e46c80e9282b83859644f1002055
|
|
4
|
+
data.tar.gz: b5cb1141f1614d45bb20094605e031acc73d04f1be190b2f9ba18122cedd3c07
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 99313b04d8bf329d57398be0fe925039e0dee7ac41c849d306d25add4ffded0759430b0dc24f8948bcf5c6d3b592e79c47f5eaf91ccd49c23d15cc0f913a01b6
|
|
7
|
+
data.tar.gz: d4d5c42188f5c2c98a218cddb2d97c287b089943d513ea3f1686f5aa319e54f404fb3c77e1733ac960becec879557956703410c1c58146ea203cc715a957554e
|
data/CHANGELOG.md
CHANGED
|
@@ -2,8 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to asterism-zenoh. The mruby / PicoRuby binding
|
|
4
4
|
(picoruby-asterism-zenoh) carries the same version number from 0.4.0 on.
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
0.4.0 is the first version on rubygems.org; the earlier ones are only in
|
|
6
|
+
this repository.
|
|
7
|
+
|
|
8
|
+
## 0.4.1
|
|
9
|
+
|
|
10
|
+
- A client session is no longer closed when its router goes away: zenoh-c
|
|
11
|
+
reconnects and declares again by itself. `Session#reconnecting?` and
|
|
12
|
+
`AUTO_RECONNECT` (true). `rake test_reconnect` (docker).
|
|
7
13
|
|
|
8
14
|
## 0.4.0
|
|
9
15
|
|
data/README.md
CHANGED
|
@@ -183,10 +183,15 @@ thread and Enumerators on top of this API are in the CRuby layer of the
|
|
|
183
183
|
- **Remote only**: a session's own puts do not reach its own subscribers,
|
|
184
184
|
and its gets do not reach its own queryables (zenoh-pico's behaviour;
|
|
185
185
|
Asterism calls its own objects in place).
|
|
186
|
-
- **Losing the connection**: a client session is closed when
|
|
187
|
-
router
|
|
188
|
-
|
|
189
|
-
|
|
186
|
+
- **Losing the connection**: a client session is not closed when its
|
|
187
|
+
router goes away: zenoh-c opens the connection again by itself and
|
|
188
|
+
declares again what the session had declared (subscribers, queryables,
|
|
189
|
+
liveliness tokens and watches); meanwhile `reconnecting?` is true, a put
|
|
190
|
+
reaches nobody and a get ends at its time limit (`rake test_reconnect`:
|
|
191
|
+
back about 1 s after a restarted zenohd). A peer session that only
|
|
192
|
+
connects is closed when it has no peer left; a listening (or scouting)
|
|
193
|
+
session stays open. Once closed, `poll` is false, `closed?` true, and
|
|
194
|
+
`put` raises `Asterism::Zenoh::ClosedError`.
|
|
190
195
|
- **Full queues drop the oldest** entry and count it in `dropped` (a dropped
|
|
191
196
|
query is finished, so its requester gets no answer from it).
|
|
192
197
|
|
data/ext/asterism_zenoh/zenoh.c
CHANGED
|
@@ -30,11 +30,16 @@
|
|
|
30
30
|
* it, the ones without it by the session's op_lock, and closing marks the
|
|
31
31
|
* session closed for Ruby (with the GVL held) before zenoh-c drops it.
|
|
32
32
|
*
|
|
33
|
-
* Losing the connection (same rules as the mruby gem):
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
33
|
+
* Losing the connection (same rules as the mruby gem):
|
|
34
|
+
* - A client session is not closed when its router goes away: zenoh-c opens
|
|
35
|
+
* the connection again by itself and declares again what the session had
|
|
36
|
+
* declared (subscribers, queryables, liveliness tokens and watches), so
|
|
37
|
+
* the Ruby objects stay valid. Meanwhile reconnecting? is true (no
|
|
38
|
+
* router), put reaches nobody and a get ends at its time limit.
|
|
39
|
+
* - A peer session that only connects is closed when it has no peer left; a
|
|
40
|
+
* listening peer session stays open.
|
|
41
|
+
* The check runs in poll, closed?, put and get. Once closed, poll returns
|
|
42
|
+
* false, closed? is true and put raises Asterism::Zenoh::ClosedError.
|
|
38
43
|
*
|
|
39
44
|
* Lifetime: closing is optional. A session keeps lists of its live
|
|
40
45
|
* subscribers, queryables and tokens and undeclares them before it closes,
|
|
@@ -2197,6 +2202,12 @@ static bool zrb_session_check_link(zrb_session *z) {
|
|
|
2197
2202
|
if (z->peer && z->listening) {
|
|
2198
2203
|
return false;
|
|
2199
2204
|
}
|
|
2205
|
+
if (!z->peer) {
|
|
2206
|
+
/* A client: zenoh-c opens a lost router connection again by itself
|
|
2207
|
+
* (and declares again what the session had declared), so no router
|
|
2208
|
+
* now means "reconnecting", not closed. */
|
|
2209
|
+
return false;
|
|
2210
|
+
}
|
|
2200
2211
|
if (zrb_session_links(z) == 0) {
|
|
2201
2212
|
zrb_session_shutdown(z, true);
|
|
2202
2213
|
return true;
|
|
@@ -2204,6 +2215,15 @@ static bool zrb_session_check_link(zrb_session *z) {
|
|
|
2204
2215
|
return false;
|
|
2205
2216
|
}
|
|
2206
2217
|
|
|
2218
|
+
/* True while a client session has no router (zenoh-c is opening the
|
|
2219
|
+
* connection again). */
|
|
2220
|
+
static bool zrb_session_reconnecting(zrb_session *z) {
|
|
2221
|
+
if (zrb_session_check_link(z) || z->peer) {
|
|
2222
|
+
return false;
|
|
2223
|
+
}
|
|
2224
|
+
return zrb_session_links(z) == 0;
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2207
2227
|
static zrb_session *zrb_session_get_open(VALUE self) {
|
|
2208
2228
|
zrb_session *z = zrb_session_get(self);
|
|
2209
2229
|
if (z->open && z->pid != getpid()) {
|
|
@@ -2823,6 +2843,12 @@ static VALUE zrb_session_closed_p(VALUE self) {
|
|
|
2823
2843
|
return zrb_session_check_link(zrb_session_get(self)) ? Qtrue : Qfalse;
|
|
2824
2844
|
}
|
|
2825
2845
|
|
|
2846
|
+
/* session.reconnecting? -> true while a client session has no router and
|
|
2847
|
+
* zenoh-c opens the connection again (see the top of this file). */
|
|
2848
|
+
static VALUE zrb_session_reconnecting_p(VALUE self) {
|
|
2849
|
+
return zrb_session_reconnecting(zrb_session_get(self)) ? Qtrue : Qfalse;
|
|
2850
|
+
}
|
|
2851
|
+
|
|
2826
2852
|
static VALUE zrb_session_close(VALUE self) {
|
|
2827
2853
|
zrb_session_shutdown(zrb_session_get(self), true);
|
|
2828
2854
|
return Qnil;
|
|
@@ -4137,6 +4163,8 @@ void Init_asterism_zenoh(void) {
|
|
|
4137
4163
|
rb_define_const(mZenoh, "CONNECT_TIMEOUT_MS", INT2FIX(ZRB_CONNECT_TIMEOUT_MS));
|
|
4138
4164
|
rb_define_const(mZenoh, "SEND_TIMEOUT_MS", INT2FIX(ZRB_SEND_TIMEOUT_MS));
|
|
4139
4165
|
rb_define_const(mZenoh, "PEER", Qtrue);
|
|
4166
|
+
/* A client session opens a lost router connection again (zenoh-c). */
|
|
4167
|
+
rb_define_const(mZenoh, "AUTO_RECONNECT", Qtrue);
|
|
4140
4168
|
/* Queue depths: the default of subscribe, queryable and the listeners;
|
|
4141
4169
|
* of get, liveliness_get and querier.get; of liveliness_watch; and the
|
|
4142
4170
|
* largest accepted. */
|
|
@@ -4200,6 +4228,7 @@ void Init_asterism_zenoh(void) {
|
|
|
4200
4228
|
rb_define_method(cSession, "connection_count", zrb_session_peers, 0);
|
|
4201
4229
|
rb_define_method(cSession, "zid", zrb_session_zid, 0);
|
|
4202
4230
|
rb_define_method(cSession, "closed?", zrb_session_closed_p, 0);
|
|
4231
|
+
rb_define_method(cSession, "reconnecting?", zrb_session_reconnecting_p, 0);
|
|
4203
4232
|
rb_define_method(cSession, "close", zrb_session_close, 0);
|
|
4204
4233
|
|
|
4205
4234
|
/* Subscriber and LivelinessWatch share one C structure. */
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: asterism-zenoh
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Katsuhiko Kageyama
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Sessions, put / subscribe, get / queryable, liveliness and attachments,
|
|
14
14
|
received by polling. The same Ruby API as Asterism's mruby / PicoRuby binding, plus
|