@kumiai/hub-tunnel 0.10.2 → 0.11.0
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.
- package/lib/events.d.ts +1 -1
- package/lib/transport.js +5 -2
- package/package.json +11 -11
package/lib/events.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DecryptError, EnvelopeDecodeError } from './errors.js';
|
|
2
|
-
export type FrameDroppedReason = 'envelope-decode' | 'decrypt' | 'group-mismatch' | 'topic-mismatch' | 'session-mismatch' | 'dedup';
|
|
2
|
+
export type FrameDroppedReason = 'envelope-decode' | 'decrypt' | 'group-mismatch' | 'topic-mismatch' | 'session-mismatch' | 'stale-session-end' | 'dedup';
|
|
3
3
|
export type ObservabilityEvent = {
|
|
4
4
|
type: 'decrypt-failed';
|
|
5
5
|
error: DecryptError;
|
package/lib/transport.js
CHANGED
|
@@ -128,7 +128,7 @@ const DEFAULT_INBOX_CAPACITY = 1024;
|
|
|
128
128
|
clearIdleTimer();
|
|
129
129
|
const elapsed = Date.now() - lastActivity;
|
|
130
130
|
const remaining = idleTimeoutMs - elapsed;
|
|
131
|
-
const delay = remaining
|
|
131
|
+
const delay = Math.max(remaining, 0);
|
|
132
132
|
idleTimer = setTimeout(()=>{
|
|
133
133
|
idleTimer = undefined;
|
|
134
134
|
if (torndown) return;
|
|
@@ -210,9 +210,12 @@ const DEFAULT_INBOX_CAPACITY = 1024;
|
|
|
210
210
|
if (lockedSessionID == null) {
|
|
211
211
|
lockedSessionID = frame.sessionID;
|
|
212
212
|
} else if (frame.sessionID !== lockedSessionID) {
|
|
213
|
+
// A peer that ends a session and at once dials again can receive the other side's
|
|
214
|
+
// session-end for the old session after the new one has locked. That is benign and
|
|
215
|
+
// distinct from frames of a foreign session reaching this consumer.
|
|
213
216
|
onEvent?.({
|
|
214
217
|
type: 'frame-dropped',
|
|
215
|
-
reason: 'session-mismatch'
|
|
218
|
+
reason: frame.kind === 'session-end' ? 'stale-session-end' : 'session-mismatch'
|
|
216
219
|
});
|
|
217
220
|
continue;
|
|
218
221
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kumiai/hub-tunnel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Peer-to-peer Enkaku transport tunneled through a hub relay",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"enkaku",
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
"lib/*"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@enkaku/transport": "^0.
|
|
30
|
-
"@kumiai/hub-protocol": "^0.
|
|
31
|
-
"@sozai/async": "^0.4.
|
|
32
|
-
"@sozai/codec": "^0.4.
|
|
33
|
-
"@sozai/event": "^0.1.
|
|
29
|
+
"@enkaku/transport": "^0.22.1",
|
|
30
|
+
"@kumiai/hub-protocol": "^0.11.0",
|
|
31
|
+
"@sozai/async": "^0.4.1",
|
|
32
|
+
"@sozai/codec": "^0.4.3",
|
|
33
|
+
"@sozai/event": "^0.1.6",
|
|
34
34
|
"@sozai/schema": "^0.1.6"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@enkaku/client": "^0.
|
|
38
|
-
"@enkaku/protocol": "^0.
|
|
39
|
-
"@enkaku/server": "^0.
|
|
40
|
-
"@kokuin/token": "^0.
|
|
41
|
-
"@kumiai/hub-conformance": "^0.
|
|
37
|
+
"@enkaku/client": "^0.22.1",
|
|
38
|
+
"@enkaku/protocol": "^0.22.1",
|
|
39
|
+
"@enkaku/server": "^0.22.1",
|
|
40
|
+
"@kokuin/token": "^0.6.1",
|
|
41
|
+
"@kumiai/hub-conformance": "^0.11.0"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|