@matter/protocol 0.16.0-alpha.0-20251210-206ca2db7 → 0.16.0-alpha.0-20251211-0f80042cf
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/cjs/action/client/ClientInteraction.d.ts +10 -3
- package/dist/cjs/action/client/ClientInteraction.d.ts.map +1 -1
- package/dist/cjs/action/client/ClientInteraction.js +35 -14
- package/dist/cjs/action/client/ClientInteraction.js.map +1 -1
- package/dist/cjs/action/client/subscription/ClientSubscriptionHandler.d.ts.map +1 -1
- package/dist/cjs/action/client/subscription/ClientSubscriptionHandler.js +22 -23
- package/dist/cjs/action/client/subscription/ClientSubscriptionHandler.js.map +1 -1
- package/dist/cjs/action/client/subscription/PeerSubscription.d.ts +2 -0
- package/dist/cjs/action/client/subscription/PeerSubscription.d.ts.map +1 -1
- package/dist/cjs/action/client/subscription/PeerSubscription.js +7 -2
- package/dist/cjs/action/client/subscription/PeerSubscription.js.map +1 -1
- package/dist/cjs/action/request/Subscribe.d.ts +0 -1
- package/dist/cjs/action/request/Subscribe.d.ts.map +1 -1
- package/dist/cjs/action/request/Subscribe.js.map +1 -1
- package/dist/cjs/interaction/AttributeDataDecoder.d.ts +1 -2
- package/dist/cjs/interaction/AttributeDataDecoder.d.ts.map +1 -1
- package/dist/cjs/peer/index.d.ts +1 -0
- package/dist/cjs/peer/index.d.ts.map +1 -1
- package/dist/cjs/peer/index.js +1 -0
- package/dist/cjs/peer/index.js.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.js +5 -6
- package/dist/cjs/protocol/ExchangeManager.js.map +1 -1
- package/dist/cjs/protocol/MessageExchange.d.ts +6 -1
- package/dist/cjs/protocol/MessageExchange.d.ts.map +1 -1
- package/dist/cjs/protocol/MessageExchange.js +11 -6
- package/dist/cjs/protocol/MessageExchange.js.map +1 -1
- package/dist/esm/action/client/ClientInteraction.d.ts +10 -3
- package/dist/esm/action/client/ClientInteraction.d.ts.map +1 -1
- package/dist/esm/action/client/ClientInteraction.js +35 -14
- package/dist/esm/action/client/ClientInteraction.js.map +1 -1
- package/dist/esm/action/client/subscription/ClientSubscriptionHandler.d.ts.map +1 -1
- package/dist/esm/action/client/subscription/ClientSubscriptionHandler.js +22 -23
- package/dist/esm/action/client/subscription/ClientSubscriptionHandler.js.map +1 -1
- package/dist/esm/action/client/subscription/PeerSubscription.d.ts +2 -0
- package/dist/esm/action/client/subscription/PeerSubscription.d.ts.map +1 -1
- package/dist/esm/action/client/subscription/PeerSubscription.js +7 -2
- package/dist/esm/action/client/subscription/PeerSubscription.js.map +1 -1
- package/dist/esm/action/request/Subscribe.d.ts +0 -1
- package/dist/esm/action/request/Subscribe.d.ts.map +1 -1
- package/dist/esm/action/request/Subscribe.js.map +1 -1
- package/dist/esm/interaction/AttributeDataDecoder.d.ts +1 -2
- package/dist/esm/interaction/AttributeDataDecoder.d.ts.map +1 -1
- package/dist/esm/peer/index.d.ts +1 -0
- package/dist/esm/peer/index.d.ts.map +1 -1
- package/dist/esm/peer/index.js +1 -0
- package/dist/esm/peer/index.js.map +1 -1
- package/dist/esm/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/esm/protocol/ExchangeManager.js +5 -6
- package/dist/esm/protocol/ExchangeManager.js.map +1 -1
- package/dist/esm/protocol/MessageExchange.d.ts +6 -1
- package/dist/esm/protocol/MessageExchange.d.ts.map +1 -1
- package/dist/esm/protocol/MessageExchange.js +11 -6
- package/dist/esm/protocol/MessageExchange.js.map +1 -1
- package/package.json +6 -6
- package/src/action/client/ClientInteraction.ts +45 -16
- package/src/action/client/subscription/ClientSubscriptionHandler.ts +29 -30
- package/src/action/client/subscription/PeerSubscription.ts +8 -2
- package/src/action/request/Subscribe.ts +0 -1
- package/src/interaction/AttributeDataDecoder.ts +1 -1
- package/src/peer/index.ts +1 -0
- package/src/protocol/ExchangeManager.ts +5 -6
- package/src/protocol/MessageExchange.ts +14 -9
|
@@ -217,6 +217,10 @@ export class MessageExchange {
|
|
|
217
217
|
return this.#closed;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
+
get considerClosed() {
|
|
221
|
+
return this.#closed.value || (this.#isInitiator && this.#closing.value);
|
|
222
|
+
}
|
|
223
|
+
|
|
220
224
|
/**
|
|
221
225
|
* Emit when the exchange is closing, but not yet closed. We only wait for acks and retries to happen, but the
|
|
222
226
|
* actual interaction logic is already done.
|
|
@@ -225,10 +229,6 @@ export class MessageExchange {
|
|
|
225
229
|
return this.#closing;
|
|
226
230
|
}
|
|
227
231
|
|
|
228
|
-
get isClosing() {
|
|
229
|
-
return this.#closing.value;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
232
|
get id() {
|
|
233
233
|
return this.#exchangeId;
|
|
234
234
|
}
|
|
@@ -505,10 +505,10 @@ export class MessageExchange {
|
|
|
505
505
|
|
|
506
506
|
#retransmitMessage(message: Message, expectedProcessingTime?: Duration) {
|
|
507
507
|
this.#retransmissionCounter++;
|
|
508
|
-
if (this.
|
|
508
|
+
if (this.considerClosed || this.#retransmissionCounter >= MRP.MAX_TRANSMISSIONS) {
|
|
509
509
|
// Ok all 4 resubmissions are done, but we need to wait a bit longer because of processing time and
|
|
510
510
|
// the resubmissions from the other side
|
|
511
|
-
if (expectedProcessingTime && !this.
|
|
511
|
+
if (expectedProcessingTime && !this.considerClosed) {
|
|
512
512
|
// We already have waited after the last message was sent, so deduct this time from the final wait time
|
|
513
513
|
const finalWaitTime = Millis(
|
|
514
514
|
this.channel.calculateMaximumPeerResponseTime(
|
|
@@ -642,7 +642,12 @@ export class MessageExchange {
|
|
|
642
642
|
return this.#timedInteractionTimer !== undefined && !this.#timedInteractionTimer.isRunning;
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
-
|
|
645
|
+
/**
|
|
646
|
+
* Closes the exchange.
|
|
647
|
+
* If force is true, the exchange will be closed immediately, even if there are still messages to send.
|
|
648
|
+
* If force is false, the exchange will be closed only after all messages have been sent.
|
|
649
|
+
*/
|
|
650
|
+
async close(force = false) {
|
|
646
651
|
if (this.#isDestroyed) {
|
|
647
652
|
return;
|
|
648
653
|
}
|
|
@@ -660,7 +665,7 @@ export class MessageExchange {
|
|
|
660
665
|
}
|
|
661
666
|
if (!this.#used) {
|
|
662
667
|
// The exchange was never in use, so we can close it directly
|
|
663
|
-
// If we see that in the wild we should fix the reasons
|
|
668
|
+
// If we see that in the wild, we should fix the reasons
|
|
664
669
|
logger.info(this.via, `Exchange never used, closing directly`);
|
|
665
670
|
return this.#close();
|
|
666
671
|
}
|
|
@@ -685,7 +690,7 @@ export class MessageExchange {
|
|
|
685
690
|
}
|
|
686
691
|
|
|
687
692
|
// Wait until all potential outstanding Resubmissions are done, also for Standalone-Acks.
|
|
688
|
-
// We might wait a bit longer
|
|
693
|
+
// We might wait a bit longer than needed, but because this is mainly a failsafe mechanism, it is acceptable.
|
|
689
694
|
// in normal case this timer is cancelled before it triggers when all retries are done.
|
|
690
695
|
let maxResubmissionTime = Instant;
|
|
691
696
|
for (let i = this.#retransmissionCounter; i <= MRP.MAX_TRANSMISSIONS; i++) {
|