@replit/river 0.26.1 → 0.26.2
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/dist/{chunk-AYIMQWS7.js → chunk-AWCUCZY4.js} +2 -2
- package/dist/{chunk-XRI2BXMM.js → chunk-IV27BICV.js} +17 -4
- package/dist/chunk-IV27BICV.js.map +1 -0
- package/dist/{chunk-6UVTCZ6K.js → chunk-M5X4JTU3.js} +3 -3
- package/dist/{chunk-6UVTCZ6K.js.map → chunk-M5X4JTU3.js.map} +1 -1
- package/dist/{chunk-UQOD22AN.js → chunk-M75K5TJS.js} +2 -2
- package/dist/{chunk-UQOD22AN.js.map → chunk-M75K5TJS.js.map} +1 -1
- package/dist/{chunk-4W5LENT2.js → chunk-MREEJE3X.js} +2 -2
- package/dist/{chunk-M43R4RPL.js → chunk-NC54BC47.js} +90 -33
- package/dist/chunk-NC54BC47.js.map +1 -0
- package/dist/{chunk-IVNX5H6C.js → chunk-YQABPD3C.js} +14 -10
- package/dist/chunk-YQABPD3C.js.map +1 -0
- package/dist/{client-0f636b3a.d.ts → client-654098be.d.ts} +1 -3
- package/dist/{connection-07e97a79.d.ts → connection-bc2454dc.d.ts} +1 -1
- package/dist/{handshake-8752f79e.d.ts → handshake-1a86f06d.d.ts} +52 -38
- package/dist/router/index.cjs +1 -1
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +7 -7
- package/dist/router/index.d.ts +7 -7
- package/dist/router/index.js +2 -2
- package/dist/{server-e304daec.d.ts → server-9a6b5a8e.d.ts} +12 -4
- package/dist/{services-fc99aae1.d.ts → services-7daa60a0.d.ts} +2 -2
- package/dist/transport/impls/ws/client.cjs +102 -32
- package/dist/transport/impls/ws/client.cjs.map +1 -1
- package/dist/transport/impls/ws/client.d.cts +3 -3
- package/dist/transport/impls/ws/client.d.ts +3 -3
- package/dist/transport/impls/ws/client.js +5 -5
- package/dist/transport/impls/ws/server.cjs +99 -38
- package/dist/transport/impls/ws/server.cjs.map +1 -1
- package/dist/transport/impls/ws/server.d.cts +3 -3
- package/dist/transport/impls/ws/server.d.ts +3 -3
- package/dist/transport/impls/ws/server.js +5 -5
- package/dist/transport/index.cjs +112 -38
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.d.cts +3 -3
- package/dist/transport/index.d.ts +3 -3
- package/dist/transport/index.js +5 -5
- package/dist/util/testHelpers.cjs +89 -32
- package/dist/util/testHelpers.cjs.map +1 -1
- package/dist/util/testHelpers.d.cts +3 -3
- package/dist/util/testHelpers.d.ts +3 -3
- package/dist/util/testHelpers.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-IVNX5H6C.js.map +0 -1
- package/dist/chunk-M43R4RPL.js.map +0 -1
- package/dist/chunk-XRI2BXMM.js.map +0 -1
- /package/dist/{chunk-AYIMQWS7.js.map → chunk-AWCUCZY4.js.map} +0 -0
- /package/dist/{chunk-4W5LENT2.js.map → chunk-MREEJE3X.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { c as TransportClientId } from '../../../message-57296605.js';
|
|
2
2
|
import { WebSocketServer } from 'ws';
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
3
|
+
import { W as WebSocketConnection } from '../../../connection-bc2454dc.js';
|
|
4
4
|
import { W as WsLike } from '../../../wslike-e0b32dd5.js';
|
|
5
|
-
import { S as ServerTransport } from '../../../server-
|
|
6
|
-
import { c as ProvidedServerTransportOptions } from '../../../handshake-
|
|
5
|
+
import { S as ServerTransport } from '../../../server-9a6b5a8e.js';
|
|
6
|
+
import { c as ProvidedServerTransportOptions } from '../../../handshake-1a86f06d.js';
|
|
7
7
|
import '@sinclair/typebox/value';
|
|
8
8
|
import '@sinclair/typebox';
|
|
9
9
|
import '@opentelemetry/api';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { c as TransportClientId } from '../../../message-57296605.js';
|
|
2
2
|
import { WebSocketServer } from 'ws';
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
3
|
+
import { W as WebSocketConnection } from '../../../connection-bc2454dc.js';
|
|
4
4
|
import { W as WsLike } from '../../../wslike-e0b32dd5.js';
|
|
5
|
-
import { S as ServerTransport } from '../../../server-
|
|
6
|
-
import { c as ProvidedServerTransportOptions } from '../../../handshake-
|
|
5
|
+
import { S as ServerTransport } from '../../../server-9a6b5a8e.js';
|
|
6
|
+
import { c as ProvidedServerTransportOptions } from '../../../handshake-1a86f06d.js';
|
|
7
7
|
import '@sinclair/typebox/value';
|
|
8
8
|
import '@sinclair/typebox';
|
|
9
9
|
import '@opentelemetry/api';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ServerTransport
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-YQABPD3C.js";
|
|
4
4
|
import {
|
|
5
5
|
WebSocketConnection
|
|
6
|
-
} from "../../../chunk-
|
|
7
|
-
import "../../../chunk-
|
|
6
|
+
} from "../../../chunk-AWCUCZY4.js";
|
|
7
|
+
import "../../../chunk-M5X4JTU3.js";
|
|
8
8
|
import "../../../chunk-TAH2GVTJ.js";
|
|
9
|
-
import "../../../chunk-
|
|
10
|
-
import "../../../chunk-
|
|
9
|
+
import "../../../chunk-NC54BC47.js";
|
|
10
|
+
import "../../../chunk-M75K5TJS.js";
|
|
11
11
|
import "../../../chunk-4PVU7J25.js";
|
|
12
12
|
|
|
13
13
|
// transport/impls/ws/server.ts
|
package/dist/transport/index.cjs
CHANGED
|
@@ -180,6 +180,7 @@ var defaultTransportOptions = {
|
|
|
180
180
|
sessionDisconnectGraceMs: 5e3,
|
|
181
181
|
connectionTimeoutMs: 2e3,
|
|
182
182
|
handshakeTimeoutMs: 1e3,
|
|
183
|
+
enableTransparentSessionReconnects: true,
|
|
183
184
|
codec: NaiveJsonCodec
|
|
184
185
|
};
|
|
185
186
|
var defaultConnectionRetryOptions = {
|
|
@@ -501,9 +502,32 @@ var IdentifiedSession = class extends CommonSession {
|
|
|
501
502
|
this.telemetry.span.end();
|
|
502
503
|
}
|
|
503
504
|
};
|
|
505
|
+
var IdentifiedSessionWithGracePeriod = class extends IdentifiedSession {
|
|
506
|
+
graceExpiryTime;
|
|
507
|
+
gracePeriodTimeout;
|
|
508
|
+
listeners;
|
|
509
|
+
constructor(props) {
|
|
510
|
+
super(props);
|
|
511
|
+
this.listeners = props.listeners;
|
|
512
|
+
this.graceExpiryTime = props.graceExpiryTime;
|
|
513
|
+
this.gracePeriodTimeout = setTimeout(() => {
|
|
514
|
+
this.listeners.onSessionGracePeriodElapsed();
|
|
515
|
+
}, this.graceExpiryTime - Date.now());
|
|
516
|
+
}
|
|
517
|
+
_handleStateExit() {
|
|
518
|
+
super._handleStateExit();
|
|
519
|
+
if (this.gracePeriodTimeout) {
|
|
520
|
+
clearTimeout(this.gracePeriodTimeout);
|
|
521
|
+
this.gracePeriodTimeout = void 0;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
_handleClose() {
|
|
525
|
+
super._handleClose();
|
|
526
|
+
}
|
|
527
|
+
};
|
|
504
528
|
|
|
505
529
|
// transport/sessionStateMachine/SessionConnecting.ts
|
|
506
|
-
var SessionConnecting = class extends
|
|
530
|
+
var SessionConnecting = class extends IdentifiedSessionWithGracePeriod {
|
|
507
531
|
state = "Connecting" /* Connecting */;
|
|
508
532
|
connPromise;
|
|
509
533
|
listeners;
|
|
@@ -536,8 +560,10 @@ var SessionConnecting = class extends IdentifiedSession {
|
|
|
536
560
|
}
|
|
537
561
|
_handleStateExit() {
|
|
538
562
|
super._handleStateExit();
|
|
539
|
-
|
|
540
|
-
|
|
563
|
+
if (this.connectionTimeout) {
|
|
564
|
+
clearTimeout(this.connectionTimeout);
|
|
565
|
+
this.connectionTimeout = void 0;
|
|
566
|
+
}
|
|
541
567
|
}
|
|
542
568
|
_handleClose() {
|
|
543
569
|
this.bestEffortClose();
|
|
@@ -546,26 +572,13 @@ var SessionConnecting = class extends IdentifiedSession {
|
|
|
546
572
|
};
|
|
547
573
|
|
|
548
574
|
// transport/sessionStateMachine/SessionNoConnection.ts
|
|
549
|
-
var SessionNoConnection = class extends
|
|
575
|
+
var SessionNoConnection = class extends IdentifiedSessionWithGracePeriod {
|
|
550
576
|
state = "NoConnection" /* NoConnection */;
|
|
551
|
-
listeners;
|
|
552
|
-
gracePeriodTimeout;
|
|
553
|
-
constructor(props) {
|
|
554
|
-
super(props);
|
|
555
|
-
this.listeners = props.listeners;
|
|
556
|
-
this.gracePeriodTimeout = setTimeout(() => {
|
|
557
|
-
this.listeners.onSessionGracePeriodElapsed();
|
|
558
|
-
}, this.options.sessionDisconnectGraceMs);
|
|
559
|
-
}
|
|
560
577
|
_handleClose() {
|
|
561
578
|
super._handleClose();
|
|
562
579
|
}
|
|
563
580
|
_handleStateExit() {
|
|
564
581
|
super._handleStateExit();
|
|
565
|
-
if (this.gracePeriodTimeout) {
|
|
566
|
-
clearTimeout(this.gracePeriodTimeout);
|
|
567
|
-
this.gracePeriodTimeout = void 0;
|
|
568
|
-
}
|
|
569
582
|
}
|
|
570
583
|
};
|
|
571
584
|
|
|
@@ -573,7 +586,7 @@ var SessionNoConnection = class extends IdentifiedSession {
|
|
|
573
586
|
var import_api = require("@opentelemetry/api");
|
|
574
587
|
|
|
575
588
|
// package.json
|
|
576
|
-
var version = "0.26.
|
|
589
|
+
var version = "0.26.2";
|
|
577
590
|
|
|
578
591
|
// tracing/index.ts
|
|
579
592
|
function getPropagationContext(ctx) {
|
|
@@ -654,7 +667,7 @@ var SessionWaitingForHandshake = class extends CommonSession {
|
|
|
654
667
|
};
|
|
655
668
|
|
|
656
669
|
// transport/sessionStateMachine/SessionHandshaking.ts
|
|
657
|
-
var SessionHandshaking = class extends
|
|
670
|
+
var SessionHandshaking = class extends IdentifiedSessionWithGracePeriod {
|
|
658
671
|
state = "Handshaking" /* Handshaking */;
|
|
659
672
|
conn;
|
|
660
673
|
listeners;
|
|
@@ -689,7 +702,10 @@ var SessionHandshaking = class extends IdentifiedSession {
|
|
|
689
702
|
this.conn.removeDataListener(this.onHandshakeData);
|
|
690
703
|
this.conn.removeErrorListener(this.listeners.onConnectionErrored);
|
|
691
704
|
this.conn.removeCloseListener(this.listeners.onConnectionClosed);
|
|
692
|
-
|
|
705
|
+
if (this.handshakeTimeout) {
|
|
706
|
+
clearTimeout(this.handshakeTimeout);
|
|
707
|
+
this.handshakeTimeout = void 0;
|
|
708
|
+
}
|
|
693
709
|
}
|
|
694
710
|
_handleClose() {
|
|
695
711
|
super._handleClose();
|
|
@@ -769,8 +785,10 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
769
785
|
}
|
|
770
786
|
onMessageData = (msg) => {
|
|
771
787
|
const parsedMsg = this.parseMsg(msg);
|
|
772
|
-
if (parsedMsg === null)
|
|
788
|
+
if (parsedMsg === null) {
|
|
789
|
+
this.listeners.onInvalidMessage("could not parse message");
|
|
773
790
|
return;
|
|
791
|
+
}
|
|
774
792
|
if (parsedMsg.seq !== this.ack) {
|
|
775
793
|
if (parsedMsg.seq < this.ack) {
|
|
776
794
|
this.log?.debug(
|
|
@@ -827,7 +845,7 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
827
845
|
};
|
|
828
846
|
|
|
829
847
|
// transport/sessionStateMachine/SessionBackingOff.ts
|
|
830
|
-
var SessionBackingOff = class extends
|
|
848
|
+
var SessionBackingOff = class extends IdentifiedSessionWithGracePeriod {
|
|
831
849
|
state = "BackingOff" /* BackingOff */;
|
|
832
850
|
listeners;
|
|
833
851
|
backoffTimeout;
|
|
@@ -864,6 +882,12 @@ function inheritSharedSession(session) {
|
|
|
864
882
|
log: session.log
|
|
865
883
|
};
|
|
866
884
|
}
|
|
885
|
+
function inheritSharedSessionWithGrace(session) {
|
|
886
|
+
return {
|
|
887
|
+
...inheritSharedSession(session),
|
|
888
|
+
graceExpiryTime: session.graceExpiryTime
|
|
889
|
+
};
|
|
890
|
+
}
|
|
867
891
|
var SessionStateGraph = {
|
|
868
892
|
entrypoints: {
|
|
869
893
|
NoConnection: (to, from, listeners, options, log) => {
|
|
@@ -877,6 +901,7 @@ var SessionStateGraph = {
|
|
|
877
901
|
to,
|
|
878
902
|
seq: 0,
|
|
879
903
|
ack: 0,
|
|
904
|
+
graceExpiryTime: Date.now() + options.sessionDisconnectGraceMs,
|
|
880
905
|
sendBuffer,
|
|
881
906
|
telemetry,
|
|
882
907
|
options,
|
|
@@ -908,7 +933,7 @@ var SessionStateGraph = {
|
|
|
908
933
|
transition: {
|
|
909
934
|
// happy path transitions
|
|
910
935
|
NoConnectionToBackingOff: (oldSession, backoffMs, listeners) => {
|
|
911
|
-
const carriedState =
|
|
936
|
+
const carriedState = inheritSharedSessionWithGrace(oldSession);
|
|
912
937
|
oldSession._handleStateExit();
|
|
913
938
|
const session = new SessionBackingOff({
|
|
914
939
|
backoffMs,
|
|
@@ -925,7 +950,7 @@ var SessionStateGraph = {
|
|
|
925
950
|
return session;
|
|
926
951
|
},
|
|
927
952
|
BackingOffToConnecting: (oldSession, connPromise, listeners) => {
|
|
928
|
-
const carriedState =
|
|
953
|
+
const carriedState = inheritSharedSessionWithGrace(oldSession);
|
|
929
954
|
oldSession._handleStateExit();
|
|
930
955
|
const session = new SessionConnecting({
|
|
931
956
|
connPromise,
|
|
@@ -942,7 +967,7 @@ var SessionStateGraph = {
|
|
|
942
967
|
return session;
|
|
943
968
|
},
|
|
944
969
|
ConnectingToHandshaking: (oldSession, conn, listeners) => {
|
|
945
|
-
const carriedState =
|
|
970
|
+
const carriedState = inheritSharedSessionWithGrace(oldSession);
|
|
946
971
|
oldSession._handleStateExit();
|
|
947
972
|
const session = new SessionHandshaking({
|
|
948
973
|
conn,
|
|
@@ -1019,9 +1044,12 @@ var SessionStateGraph = {
|
|
|
1019
1044
|
},
|
|
1020
1045
|
// disconnect paths
|
|
1021
1046
|
BackingOffToNoConnection: (oldSession, listeners) => {
|
|
1022
|
-
const carriedState =
|
|
1047
|
+
const carriedState = inheritSharedSessionWithGrace(oldSession);
|
|
1023
1048
|
oldSession._handleStateExit();
|
|
1024
|
-
const session = new SessionNoConnection({
|
|
1049
|
+
const session = new SessionNoConnection({
|
|
1050
|
+
listeners,
|
|
1051
|
+
...carriedState
|
|
1052
|
+
});
|
|
1025
1053
|
session.log?.info(
|
|
1026
1054
|
`session ${session.id} transition from BackingOff to NoConnection`,
|
|
1027
1055
|
{
|
|
@@ -1032,10 +1060,13 @@ var SessionStateGraph = {
|
|
|
1032
1060
|
return session;
|
|
1033
1061
|
},
|
|
1034
1062
|
ConnectingToNoConnection: (oldSession, listeners) => {
|
|
1035
|
-
const carriedState =
|
|
1063
|
+
const carriedState = inheritSharedSessionWithGrace(oldSession);
|
|
1036
1064
|
oldSession.bestEffortClose();
|
|
1037
1065
|
oldSession._handleStateExit();
|
|
1038
|
-
const session = new SessionNoConnection({
|
|
1066
|
+
const session = new SessionNoConnection({
|
|
1067
|
+
listeners,
|
|
1068
|
+
...carriedState
|
|
1069
|
+
});
|
|
1039
1070
|
session.log?.info(
|
|
1040
1071
|
`session ${session.id} transition from Connecting to NoConnection`,
|
|
1041
1072
|
{
|
|
@@ -1046,10 +1077,13 @@ var SessionStateGraph = {
|
|
|
1046
1077
|
return session;
|
|
1047
1078
|
},
|
|
1048
1079
|
HandshakingToNoConnection: (oldSession, listeners) => {
|
|
1049
|
-
const carriedState =
|
|
1080
|
+
const carriedState = inheritSharedSessionWithGrace(oldSession);
|
|
1050
1081
|
oldSession.conn.close();
|
|
1051
1082
|
oldSession._handleStateExit();
|
|
1052
|
-
const session = new SessionNoConnection({
|
|
1083
|
+
const session = new SessionNoConnection({
|
|
1084
|
+
listeners,
|
|
1085
|
+
...carriedState
|
|
1086
|
+
});
|
|
1053
1087
|
session.log?.info(
|
|
1054
1088
|
`session ${session.id} transition from Handshaking to NoConnection`,
|
|
1055
1089
|
{
|
|
@@ -1061,9 +1095,14 @@ var SessionStateGraph = {
|
|
|
1061
1095
|
},
|
|
1062
1096
|
ConnectedToNoConnection: (oldSession, listeners) => {
|
|
1063
1097
|
const carriedState = inheritSharedSession(oldSession);
|
|
1098
|
+
const graceExpiryTime = Date.now() + oldSession.options.sessionDisconnectGraceMs;
|
|
1064
1099
|
oldSession.conn.close();
|
|
1065
1100
|
oldSession._handleStateExit();
|
|
1066
|
-
const session = new SessionNoConnection({
|
|
1101
|
+
const session = new SessionNoConnection({
|
|
1102
|
+
listeners,
|
|
1103
|
+
graceExpiryTime,
|
|
1104
|
+
...carriedState
|
|
1105
|
+
});
|
|
1067
1106
|
session.log?.info(
|
|
1068
1107
|
`session ${session.id} transition from Connected to NoConnection`,
|
|
1069
1108
|
{
|
|
@@ -1080,24 +1119,42 @@ var ClientSessionStateGraph = {
|
|
|
1080
1119
|
entrypoint: SessionStateGraph.entrypoints.NoConnection,
|
|
1081
1120
|
transition: {
|
|
1082
1121
|
// happy paths
|
|
1122
|
+
// NoConnection -> BackingOff: attempt to connect
|
|
1083
1123
|
NoConnectionToBackingOff: transitions.NoConnectionToBackingOff,
|
|
1124
|
+
// BackingOff -> Connecting: backoff period elapsed, start connection
|
|
1084
1125
|
BackingOffToConnecting: transitions.BackingOffToConnecting,
|
|
1126
|
+
// Connecting -> Handshaking: connection established, start handshake
|
|
1085
1127
|
ConnectingToHandshaking: transitions.ConnectingToHandshaking,
|
|
1128
|
+
// Handshaking -> Connected: handshake complete, session ready
|
|
1086
1129
|
HandshakingToConnected: transitions.HandshakingToConnected,
|
|
1087
1130
|
// disconnect paths
|
|
1131
|
+
// BackingOff -> NoConnection: unused
|
|
1088
1132
|
BackingOffToNoConnection: transitions.BackingOffToNoConnection,
|
|
1133
|
+
// Connecting -> NoConnection: connection failed or connection timeout
|
|
1089
1134
|
ConnectingToNoConnection: transitions.ConnectingToNoConnection,
|
|
1135
|
+
// Handshaking -> NoConnection: connection closed or handshake timeout
|
|
1090
1136
|
HandshakingToNoConnection: transitions.HandshakingToNoConnection,
|
|
1137
|
+
// Connected -> NoConnection: connection closed
|
|
1091
1138
|
ConnectedToNoConnection: transitions.ConnectedToNoConnection
|
|
1139
|
+
// destroy/close paths
|
|
1140
|
+
// NoConnection -> x: grace period elapsed
|
|
1141
|
+
// BackingOff -> x: grace period elapsed
|
|
1142
|
+
// Connecting -> x: grace period elapsed
|
|
1143
|
+
// Handshaking -> x: grace period elapsed or invalid handshake message or handshake rejection
|
|
1144
|
+
// Connected -> x: grace period elapsed or invalid message
|
|
1092
1145
|
}
|
|
1093
1146
|
};
|
|
1094
1147
|
var ServerSessionStateGraph = {
|
|
1095
1148
|
entrypoint: SessionStateGraph.entrypoints.WaitingForHandshake,
|
|
1096
1149
|
transition: {
|
|
1097
1150
|
// happy paths
|
|
1151
|
+
// WaitingForHandshake -> Connected: handshake complete, session ready
|
|
1098
1152
|
WaitingForHandshakeToConnected: transitions.WaitingForHandshakeToConnected,
|
|
1099
1153
|
// disconnect paths
|
|
1154
|
+
// Connected -> NoConnection: connection closed
|
|
1100
1155
|
ConnectedToNoConnection: transitions.ConnectedToNoConnection
|
|
1156
|
+
// destroy/close paths
|
|
1157
|
+
// WaitingForHandshake -> x: handshake timeout elapsed or invalid handshake message or handshake rejection or connection closed
|
|
1101
1158
|
}
|
|
1102
1159
|
};
|
|
1103
1160
|
|
|
@@ -1363,6 +1420,10 @@ var ClientTransport = class extends Transport {
|
|
|
1363
1420
|
this.handshakeExtensions = options;
|
|
1364
1421
|
}
|
|
1365
1422
|
tryReconnecting(to) {
|
|
1423
|
+
const oldSession = this.sessions.get(to);
|
|
1424
|
+
if (!this.options.enableTransparentSessionReconnects && oldSession) {
|
|
1425
|
+
this.deleteSession(oldSession);
|
|
1426
|
+
}
|
|
1366
1427
|
if (this.reconnectOnConnectionDrop && this.getStatus() === "open") {
|
|
1367
1428
|
this.connect(to);
|
|
1368
1429
|
}
|
|
@@ -1449,6 +1510,9 @@ var ClientTransport = class extends Transport {
|
|
|
1449
1510
|
handshakingSession.loggingMetadata
|
|
1450
1511
|
);
|
|
1451
1512
|
this.onConnClosed(handshakingSession);
|
|
1513
|
+
},
|
|
1514
|
+
onSessionGracePeriodElapsed: () => {
|
|
1515
|
+
this.onSessionGracePeriodElapsed(handshakingSession);
|
|
1452
1516
|
}
|
|
1453
1517
|
}
|
|
1454
1518
|
);
|
|
@@ -1595,6 +1659,9 @@ var ClientTransport = class extends Transport {
|
|
|
1595
1659
|
}
|
|
1596
1660
|
);
|
|
1597
1661
|
this.onBackoffFinished(backingOffSession, reconnectPromise);
|
|
1662
|
+
},
|
|
1663
|
+
onSessionGracePeriodElapsed: () => {
|
|
1664
|
+
this.onSessionGracePeriodElapsed(backingOffSession);
|
|
1598
1665
|
}
|
|
1599
1666
|
}
|
|
1600
1667
|
);
|
|
@@ -1626,6 +1693,9 @@ var ClientTransport = class extends Transport {
|
|
|
1626
1693
|
connectingSession.loggingMetadata
|
|
1627
1694
|
);
|
|
1628
1695
|
this.onConnectingFailed(connectingSession);
|
|
1696
|
+
},
|
|
1697
|
+
onSessionGracePeriodElapsed: () => {
|
|
1698
|
+
this.onSessionGracePeriodElapsed(connectingSession);
|
|
1629
1699
|
}
|
|
1630
1700
|
}
|
|
1631
1701
|
);
|
|
@@ -1860,7 +1930,7 @@ var ServerTransport = class extends Transport {
|
|
|
1860
1930
|
let connectCase = "new session";
|
|
1861
1931
|
const clientNextExpectedSeq = msg.payload.expectedSessionState.nextExpectedSeq;
|
|
1862
1932
|
const clientNextSentSeq = msg.payload.expectedSessionState.nextSentSeq ?? 0;
|
|
1863
|
-
if (oldSession && oldSession.id === msg.payload.sessionId) {
|
|
1933
|
+
if (this.options.enableTransparentSessionReconnects && oldSession && oldSession.id === msg.payload.sessionId) {
|
|
1864
1934
|
connectCase = "transparent reconnection";
|
|
1865
1935
|
const ourNextSeq = oldSession.nextSeq();
|
|
1866
1936
|
const ourAck = oldSession.ack;
|
|
@@ -1919,10 +1989,11 @@ var ServerTransport = class extends Transport {
|
|
|
1919
1989
|
}
|
|
1920
1990
|
if (!oldSession && (clientNextSentSeq > 0 || clientNextExpectedSeq > 0)) {
|
|
1921
1991
|
connectCase = "unknown session";
|
|
1992
|
+
const rejectionMessage = this.options.enableTransparentSessionReconnects ? `client is trying to reconnect to a session the server don't know about: ${msg.payload.sessionId}` : `client is attempting a transparent reconnect to a session but the server does not support it: ${msg.payload.sessionId}`;
|
|
1922
1993
|
this.rejectHandshakeRequest(
|
|
1923
1994
|
session,
|
|
1924
1995
|
msg.from,
|
|
1925
|
-
|
|
1996
|
+
rejectionMessage,
|
|
1926
1997
|
"SESSION_STATE_MISMATCH",
|
|
1927
1998
|
{
|
|
1928
1999
|
...session.loggingMetadata,
|
|
@@ -2007,16 +2078,19 @@ var ServerTransport = class extends Transport {
|
|
|
2007
2078
|
return false;
|
|
2008
2079
|
}
|
|
2009
2080
|
const previousParsedMetadata = existingSession ? this.sessionHandshakeMetadata.get(existingSession.to) : void 0;
|
|
2010
|
-
const
|
|
2081
|
+
const parsedMetadataOrFailureCode = await this.handshakeExtensions.validate(
|
|
2011
2082
|
rawMetadata,
|
|
2012
2083
|
previousParsedMetadata
|
|
2013
2084
|
);
|
|
2014
|
-
if (import_value3.Value.Check(
|
|
2085
|
+
if (import_value3.Value.Check(
|
|
2086
|
+
HandshakeErrorCustomHandlerFatalResponseCodes,
|
|
2087
|
+
parsedMetadataOrFailureCode
|
|
2088
|
+
)) {
|
|
2015
2089
|
this.rejectHandshakeRequest(
|
|
2016
2090
|
handshakingSession,
|
|
2017
2091
|
from,
|
|
2018
2092
|
"rejected by handshake handler",
|
|
2019
|
-
|
|
2093
|
+
parsedMetadataOrFailureCode,
|
|
2020
2094
|
{
|
|
2021
2095
|
...handshakingSession.loggingMetadata,
|
|
2022
2096
|
connectedTo: from,
|
|
@@ -2025,7 +2099,7 @@ var ServerTransport = class extends Transport {
|
|
|
2025
2099
|
);
|
|
2026
2100
|
return false;
|
|
2027
2101
|
}
|
|
2028
|
-
return
|
|
2102
|
+
return parsedMetadataOrFailureCode;
|
|
2029
2103
|
}
|
|
2030
2104
|
};
|
|
2031
2105
|
|