@matter/protocol 0.16.0-alpha.0-20251203-aaf94bca8 → 0.16.0-alpha.0-20251207-37e501b18
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.map +1 -1
- package/dist/cjs/action/client/ClientInteraction.js +82 -34
- package/dist/cjs/action/client/ClientInteraction.js.map +2 -2
- package/dist/cjs/action/client/subscription/ClientSubscription.d.ts +10 -5
- package/dist/cjs/action/client/subscription/ClientSubscription.d.ts.map +1 -1
- package/dist/cjs/action/client/subscription/ClientSubscription.js +21 -1
- package/dist/cjs/action/client/subscription/ClientSubscription.js.map +2 -2
- package/dist/cjs/action/client/subscription/ClientSubscriptionHandler.js +2 -3
- package/dist/cjs/action/client/subscription/ClientSubscriptionHandler.js.map +1 -1
- package/dist/cjs/action/client/subscription/ClientSubscriptions.d.ts +4 -2
- package/dist/cjs/action/client/subscription/ClientSubscriptions.d.ts.map +1 -1
- package/dist/cjs/action/client/subscription/ClientSubscriptions.js +68 -8
- package/dist/cjs/action/client/subscription/ClientSubscriptions.js.map +1 -1
- package/dist/cjs/action/client/subscription/PeerSubscription.d.ts +0 -1
- package/dist/cjs/action/client/subscription/PeerSubscription.d.ts.map +1 -1
- package/dist/cjs/action/client/subscription/PeerSubscription.js +1 -2
- package/dist/cjs/action/client/subscription/PeerSubscription.js.map +1 -1
- package/dist/cjs/action/client/subscription/SustainedSubscription.d.ts +0 -2
- package/dist/cjs/action/client/subscription/SustainedSubscription.d.ts.map +1 -1
- package/dist/cjs/action/client/subscription/SustainedSubscription.js +2 -4
- package/dist/cjs/action/client/subscription/SustainedSubscription.js.map +1 -1
- package/dist/cjs/action/request/Invoke.js +2 -2
- package/dist/cjs/action/request/Invoke.js.map +1 -1
- package/dist/cjs/action/server/AttributeReadResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/AttributeReadResponse.js +78 -25
- package/dist/cjs/action/server/AttributeReadResponse.js.map +1 -1
- package/dist/cjs/action/server/AttributeWriteResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/AttributeWriteResponse.js +70 -17
- package/dist/cjs/action/server/AttributeWriteResponse.js.map +1 -1
- package/dist/cjs/action/server/CommandInvokeResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/CommandInvokeResponse.js +83 -30
- package/dist/cjs/action/server/CommandInvokeResponse.js.map +1 -1
- package/dist/cjs/action/server/DataResponse.d.ts +1 -0
- package/dist/cjs/action/server/DataResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/DataResponse.js +3 -0
- package/dist/cjs/action/server/DataResponse.js.map +1 -1
- package/dist/cjs/action/server/ServerInteraction.d.ts.map +1 -1
- package/dist/cjs/action/server/ServerInteraction.js +4 -4
- package/dist/cjs/action/server/ServerInteraction.js.map +1 -1
- package/dist/cjs/advertisement/Advertisement.d.ts.map +1 -1
- package/dist/cjs/advertisement/Advertisement.js +66 -14
- package/dist/cjs/advertisement/Advertisement.js.map +1 -1
- package/dist/cjs/advertisement/Advertiser.d.ts +4 -1
- package/dist/cjs/advertisement/Advertiser.d.ts.map +1 -1
- package/dist/cjs/advertisement/Advertiser.js +63 -2
- package/dist/cjs/advertisement/Advertiser.js.map +1 -1
- package/dist/cjs/advertisement/ble/BleAdvertiser.d.ts +6 -1
- package/dist/cjs/advertisement/ble/BleAdvertiser.d.ts.map +1 -1
- package/dist/cjs/advertisement/ble/BleAdvertiser.js +1 -1
- package/dist/cjs/advertisement/ble/BleAdvertiser.js.map +1 -1
- package/dist/cjs/advertisement/mdns/MdnsAdvertiser.d.ts +5 -1
- package/dist/cjs/advertisement/mdns/MdnsAdvertiser.d.ts.map +1 -1
- package/dist/cjs/advertisement/mdns/MdnsAdvertiser.js +1 -1
- package/dist/cjs/advertisement/mdns/MdnsAdvertiser.js.map +1 -1
- package/dist/cjs/certificate/kinds/definitions/asn.js +1 -1
- package/dist/cjs/certificate/kinds/definitions/asn.js.map +1 -1
- package/dist/cjs/certificate/kinds/definitions/attestation.d.ts.map +1 -1
- package/dist/cjs/cluster/client/AttributeClient.d.ts.map +1 -1
- package/dist/cjs/cluster/client/AttributeClient.js +2 -2
- package/dist/cjs/cluster/client/AttributeClient.js.map +1 -1
- package/dist/cjs/codec/MessageCodec.d.ts +8 -1
- package/dist/cjs/codec/MessageCodec.d.ts.map +1 -1
- package/dist/cjs/codec/MessageCodec.js +38 -28
- package/dist/cjs/codec/MessageCodec.js.map +2 -2
- package/dist/cjs/common/FailsafeContext.d.ts +8 -9
- package/dist/cjs/common/FailsafeContext.d.ts.map +1 -1
- package/dist/cjs/common/FailsafeContext.js +27 -33
- package/dist/cjs/common/FailsafeContext.js.map +1 -1
- package/dist/cjs/common/FailsafeTimer.d.ts +4 -3
- package/dist/cjs/common/FailsafeTimer.d.ts.map +1 -1
- package/dist/cjs/common/FailsafeTimer.js +4 -4
- package/dist/cjs/common/FailsafeTimer.js.map +1 -1
- package/dist/cjs/common/Mark.d.ts +17 -0
- package/dist/cjs/common/Mark.d.ts.map +1 -0
- package/dist/cjs/{peer/OperationalPeer.js → common/Mark.js} +19 -3
- package/dist/cjs/common/Mark.js.map +6 -0
- package/dist/cjs/common/index.d.ts +1 -0
- package/dist/cjs/common/index.d.ts.map +1 -1
- package/dist/cjs/common/index.js +1 -0
- package/dist/cjs/common/index.js.map +1 -1
- package/dist/cjs/fabric/Fabric.d.ts +16 -8
- package/dist/cjs/fabric/Fabric.d.ts.map +1 -1
- package/dist/cjs/fabric/Fabric.js +35 -18
- package/dist/cjs/fabric/Fabric.js.map +1 -1
- package/dist/cjs/fabric/FabricAuthority.d.ts +2 -2
- package/dist/cjs/fabric/FabricAuthority.d.ts.map +1 -1
- package/dist/cjs/fabric/FabricAuthority.js +3 -3
- package/dist/cjs/fabric/FabricAuthority.js.map +1 -1
- package/dist/cjs/fabric/FabricManager.d.ts +10 -14
- package/dist/cjs/fabric/FabricManager.d.ts.map +1 -1
- package/dist/cjs/fabric/FabricManager.js +44 -40
- package/dist/cjs/fabric/FabricManager.js.map +2 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interaction/AttributeDataEncoder.d.ts +1 -1
- package/dist/cjs/interaction/InteractionClient.d.ts +2 -2
- package/dist/cjs/interaction/InteractionClient.d.ts.map +1 -1
- package/dist/cjs/interaction/InteractionClient.js +39 -22
- package/dist/cjs/interaction/InteractionClient.js.map +1 -1
- package/dist/cjs/interaction/InteractionMessenger.d.ts +2 -2
- package/dist/cjs/interaction/InteractionMessenger.d.ts.map +1 -1
- package/dist/cjs/interaction/InteractionMessenger.js +35 -27
- package/dist/cjs/interaction/InteractionMessenger.js.map +1 -1
- package/dist/cjs/interaction/Subscription.d.ts +16 -37
- package/dist/cjs/interaction/Subscription.d.ts.map +1 -1
- package/dist/cjs/interaction/Subscription.js +15 -68
- package/dist/cjs/interaction/Subscription.js.map +2 -2
- package/dist/cjs/interaction/SubscriptionClient.d.ts +2 -2
- package/dist/cjs/interaction/SubscriptionClient.d.ts.map +1 -1
- package/dist/cjs/interaction/SubscriptionClient.js +2 -2
- package/dist/cjs/interaction/SubscriptionClient.js.map +1 -1
- package/dist/cjs/mdns/MdnsClient.d.ts +10 -10
- package/dist/cjs/mdns/MdnsClient.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsClient.js +165 -80
- package/dist/cjs/mdns/MdnsClient.js.map +1 -1
- package/dist/cjs/mdns/MdnsServer.d.ts +2 -2
- package/dist/cjs/mdns/MdnsServer.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsServer.js +173 -94
- package/dist/cjs/mdns/MdnsServer.js.map +2 -2
- package/dist/cjs/mdns/MdnsService.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsService.js +3 -2
- package/dist/cjs/mdns/MdnsService.js.map +1 -1
- package/dist/cjs/mdns/MdnsSocket.d.ts +3 -2
- package/dist/cjs/mdns/MdnsSocket.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsSocket.js +2 -1
- package/dist/cjs/mdns/MdnsSocket.js.map +1 -1
- package/dist/cjs/peer/ControllerCommissioner.d.ts +2 -2
- package/dist/cjs/peer/ControllerCommissioner.d.ts.map +1 -1
- package/dist/cjs/peer/ControllerCommissioner.js +26 -28
- package/dist/cjs/peer/ControllerCommissioner.js.map +1 -1
- package/dist/cjs/peer/ControllerDiscovery.d.ts +1 -1
- package/dist/cjs/peer/ControllerDiscovery.d.ts.map +1 -1
- package/dist/cjs/peer/ControllerDiscovery.js +3 -3
- package/dist/cjs/peer/ControllerDiscovery.js.map +1 -1
- package/dist/cjs/peer/Peer.d.ts +57 -0
- package/dist/cjs/peer/Peer.d.ts.map +1 -0
- package/dist/cjs/peer/Peer.js +182 -0
- package/dist/cjs/peer/Peer.js.map +6 -0
- package/dist/cjs/peer/PeerAddress.d.ts.map +1 -1
- package/dist/cjs/peer/PeerAddress.js +5 -2
- package/dist/cjs/peer/PeerAddress.js.map +1 -1
- package/dist/cjs/peer/PeerAddressStore.d.ts +3 -3
- package/dist/cjs/peer/PeerAddressStore.d.ts.map +1 -1
- package/{src/peer/OperationalPeer.ts → dist/cjs/peer/PeerDescriptor.d.ts} +14 -12
- package/dist/cjs/peer/PeerDescriptor.d.ts.map +1 -0
- package/dist/cjs/peer/PeerDescriptor.js +71 -0
- package/dist/cjs/peer/PeerDescriptor.js.map +6 -0
- package/dist/cjs/peer/PeerSet.d.ts +23 -26
- package/dist/cjs/peer/PeerSet.d.ts.map +1 -1
- package/dist/cjs/peer/PeerSet.js +173 -173
- package/dist/cjs/peer/PeerSet.js.map +2 -2
- package/dist/cjs/peer/index.d.ts +1 -1
- package/dist/cjs/peer/index.d.ts.map +1 -1
- package/dist/cjs/peer/index.js +1 -1
- package/dist/cjs/peer/index.js.map +1 -1
- package/dist/cjs/protocol/DeviceAdvertiser.js +4 -4
- package/dist/cjs/protocol/DeviceAdvertiser.js.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.d.ts +6 -9
- package/dist/cjs/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.js +306 -246
- package/dist/cjs/protocol/ExchangeManager.js.map +2 -2
- package/dist/cjs/protocol/ExchangeProvider.d.ts +9 -11
- package/dist/cjs/protocol/ExchangeProvider.d.ts.map +1 -1
- package/dist/cjs/protocol/ExchangeProvider.js +79 -32
- package/dist/cjs/protocol/ExchangeProvider.js.map +2 -2
- package/dist/cjs/protocol/MessageChannel.d.ts +6 -7
- package/dist/cjs/protocol/MessageChannel.d.ts.map +1 -1
- package/dist/cjs/protocol/MessageChannel.js +14 -16
- package/dist/cjs/protocol/MessageChannel.js.map +1 -1
- package/dist/cjs/protocol/MessageCounter.d.ts +4 -4
- package/dist/cjs/protocol/MessageCounter.d.ts.map +1 -1
- package/dist/cjs/protocol/MessageCounter.js +7 -7
- package/dist/cjs/protocol/MessageCounter.js.map +1 -1
- package/dist/cjs/protocol/MessageExchange.d.ts +31 -20
- package/dist/cjs/protocol/MessageExchange.d.ts.map +1 -1
- package/dist/cjs/protocol/MessageExchange.js +316 -231
- package/dist/cjs/protocol/MessageExchange.js.map +2 -2
- package/dist/cjs/protocol/ProtocolMocks.d.ts +100 -0
- package/dist/cjs/protocol/ProtocolMocks.d.ts.map +1 -0
- package/dist/cjs/protocol/ProtocolMocks.js +237 -0
- package/dist/cjs/protocol/ProtocolMocks.js.map +6 -0
- package/dist/cjs/protocol/errors.d.ts +35 -0
- package/dist/cjs/protocol/errors.d.ts.map +1 -0
- package/dist/cjs/protocol/errors.js +50 -0
- package/dist/cjs/protocol/errors.js.map +6 -0
- package/dist/cjs/protocol/index.d.ts +2 -1
- package/dist/cjs/protocol/index.d.ts.map +1 -1
- package/dist/cjs/protocol/index.js +2 -1
- package/dist/cjs/protocol/index.js.map +1 -1
- package/dist/cjs/securechannel/SecureChannelMessenger.d.ts +1 -0
- package/dist/cjs/securechannel/SecureChannelMessenger.d.ts.map +1 -1
- package/dist/cjs/securechannel/SecureChannelMessenger.js +3 -0
- package/dist/cjs/securechannel/SecureChannelMessenger.js.map +1 -1
- package/dist/cjs/securechannel/SecureChannelProtocol.js +2 -2
- package/dist/cjs/securechannel/SecureChannelProtocol.js.map +1 -1
- package/dist/cjs/session/GroupSession.d.ts +21 -10
- package/dist/cjs/session/GroupSession.d.ts.map +1 -1
- package/dist/cjs/session/GroupSession.js +37 -12
- package/dist/cjs/session/GroupSession.js.map +1 -1
- package/dist/cjs/session/NodeSession.d.ts +56 -50
- package/dist/cjs/session/NodeSession.d.ts.map +1 -1
- package/dist/cjs/session/NodeSession.js +95 -103
- package/dist/cjs/session/NodeSession.js.map +1 -1
- package/dist/cjs/session/SecureSession.d.ts +4 -4
- package/dist/cjs/session/SecureSession.d.ts.map +1 -1
- package/dist/cjs/session/SecureSession.js +1 -1
- package/dist/cjs/session/SecureSession.js.map +1 -1
- package/dist/cjs/session/Session.d.ts +82 -66
- package/dist/cjs/session/Session.d.ts.map +1 -1
- package/dist/cjs/session/Session.js +218 -45
- package/dist/cjs/session/Session.js.map +1 -1
- package/dist/cjs/session/SessionManager.d.ts +33 -36
- package/dist/cjs/session/SessionManager.d.ts.map +1 -1
- package/dist/cjs/session/SessionManager.js +112 -150
- package/dist/cjs/session/SessionManager.js.map +1 -1
- package/dist/cjs/session/SessionParameters.d.ts +87 -0
- package/dist/cjs/session/SessionParameters.d.ts.map +1 -0
- package/dist/cjs/session/SessionParameters.js +81 -0
- package/dist/cjs/session/SessionParameters.js.map +6 -0
- package/dist/{esm/session/InsecureSession.d.ts → cjs/session/UnsecuredSession.d.ts} +18 -16
- package/dist/cjs/session/UnsecuredSession.d.ts.map +1 -0
- package/dist/cjs/session/{InsecureSession.js → UnsecuredSession.js} +21 -21
- package/dist/cjs/session/UnsecuredSession.js.map +6 -0
- package/dist/cjs/session/case/CaseClient.d.ts.map +1 -1
- package/dist/cjs/session/case/CaseClient.js +6 -4
- package/dist/cjs/session/case/CaseClient.js.map +1 -1
- package/dist/cjs/session/case/CaseServer.d.ts.map +1 -1
- package/dist/cjs/session/case/CaseServer.js +14 -10
- package/dist/cjs/session/case/CaseServer.js.map +1 -1
- package/dist/cjs/session/index.d.ts +2 -1
- package/dist/cjs/session/index.d.ts.map +1 -1
- package/dist/cjs/session/index.js +2 -1
- package/dist/cjs/session/index.js.map +1 -1
- package/dist/cjs/session/pase/PaseClient.d.ts +3 -3
- package/dist/cjs/session/pase/PaseClient.d.ts.map +1 -1
- package/dist/cjs/session/pase/PaseClient.js +5 -3
- package/dist/cjs/session/pase/PaseClient.js.map +1 -1
- package/dist/cjs/session/pase/PaseServer.d.ts.map +1 -1
- package/dist/cjs/session/pase/PaseServer.js +13 -13
- package/dist/cjs/session/pase/PaseServer.js.map +1 -1
- package/dist/esm/action/client/ClientInteraction.d.ts.map +1 -1
- package/dist/esm/action/client/ClientInteraction.js +82 -34
- package/dist/esm/action/client/ClientInteraction.js.map +2 -2
- package/dist/esm/action/client/subscription/ClientSubscription.d.ts +10 -5
- package/dist/esm/action/client/subscription/ClientSubscription.d.ts.map +1 -1
- package/dist/esm/action/client/subscription/ClientSubscription.js +22 -2
- package/dist/esm/action/client/subscription/ClientSubscription.js.map +2 -2
- package/dist/esm/action/client/subscription/ClientSubscriptionHandler.js +2 -3
- package/dist/esm/action/client/subscription/ClientSubscriptionHandler.js.map +1 -1
- package/dist/esm/action/client/subscription/ClientSubscriptions.d.ts +4 -2
- package/dist/esm/action/client/subscription/ClientSubscriptions.d.ts.map +1 -1
- package/dist/esm/action/client/subscription/ClientSubscriptions.js +68 -8
- package/dist/esm/action/client/subscription/ClientSubscriptions.js.map +1 -1
- package/dist/esm/action/client/subscription/PeerSubscription.d.ts +0 -1
- package/dist/esm/action/client/subscription/PeerSubscription.d.ts.map +1 -1
- package/dist/esm/action/client/subscription/PeerSubscription.js +1 -2
- package/dist/esm/action/client/subscription/PeerSubscription.js.map +1 -1
- package/dist/esm/action/client/subscription/SustainedSubscription.d.ts +0 -2
- package/dist/esm/action/client/subscription/SustainedSubscription.d.ts.map +1 -1
- package/dist/esm/action/client/subscription/SustainedSubscription.js +2 -4
- package/dist/esm/action/client/subscription/SustainedSubscription.js.map +1 -1
- package/dist/esm/action/request/Invoke.js +2 -2
- package/dist/esm/action/request/Invoke.js.map +1 -1
- package/dist/esm/action/server/AttributeReadResponse.d.ts.map +1 -1
- package/dist/esm/action/server/AttributeReadResponse.js +78 -25
- package/dist/esm/action/server/AttributeReadResponse.js.map +1 -1
- package/dist/esm/action/server/AttributeWriteResponse.d.ts.map +1 -1
- package/dist/esm/action/server/AttributeWriteResponse.js +70 -17
- package/dist/esm/action/server/AttributeWriteResponse.js.map +1 -1
- package/dist/esm/action/server/CommandInvokeResponse.d.ts.map +1 -1
- package/dist/esm/action/server/CommandInvokeResponse.js +83 -30
- package/dist/esm/action/server/CommandInvokeResponse.js.map +1 -1
- package/dist/esm/action/server/DataResponse.d.ts +1 -0
- package/dist/esm/action/server/DataResponse.d.ts.map +1 -1
- package/dist/esm/action/server/DataResponse.js +3 -0
- package/dist/esm/action/server/DataResponse.js.map +1 -1
- package/dist/esm/action/server/ServerInteraction.d.ts.map +1 -1
- package/dist/esm/action/server/ServerInteraction.js +4 -4
- package/dist/esm/action/server/ServerInteraction.js.map +1 -1
- package/dist/esm/advertisement/Advertisement.d.ts.map +1 -1
- package/dist/esm/advertisement/Advertisement.js +66 -14
- package/dist/esm/advertisement/Advertisement.js.map +1 -1
- package/dist/esm/advertisement/Advertiser.d.ts +4 -1
- package/dist/esm/advertisement/Advertiser.d.ts.map +1 -1
- package/dist/esm/advertisement/Advertiser.js +63 -2
- package/dist/esm/advertisement/Advertiser.js.map +1 -1
- package/dist/esm/advertisement/ble/BleAdvertiser.d.ts +6 -1
- package/dist/esm/advertisement/ble/BleAdvertiser.d.ts.map +1 -1
- package/dist/esm/advertisement/ble/BleAdvertiser.js +1 -1
- package/dist/esm/advertisement/ble/BleAdvertiser.js.map +1 -1
- package/dist/esm/advertisement/mdns/MdnsAdvertiser.d.ts +5 -1
- package/dist/esm/advertisement/mdns/MdnsAdvertiser.d.ts.map +1 -1
- package/dist/esm/advertisement/mdns/MdnsAdvertiser.js +1 -1
- package/dist/esm/advertisement/mdns/MdnsAdvertiser.js.map +1 -1
- package/dist/esm/certificate/kinds/definitions/asn.js +2 -2
- package/dist/esm/certificate/kinds/definitions/asn.js.map +1 -1
- package/dist/esm/certificate/kinds/definitions/attestation.d.ts.map +1 -1
- package/dist/esm/cluster/client/AttributeClient.d.ts.map +1 -1
- package/dist/esm/cluster/client/AttributeClient.js +1 -1
- package/dist/esm/cluster/client/AttributeClient.js.map +1 -1
- package/dist/esm/codec/MessageCodec.d.ts +8 -1
- package/dist/esm/codec/MessageCodec.d.ts.map +1 -1
- package/dist/esm/codec/MessageCodec.js +39 -28
- package/dist/esm/codec/MessageCodec.js.map +2 -2
- package/dist/esm/common/FailsafeContext.d.ts +8 -9
- package/dist/esm/common/FailsafeContext.d.ts.map +1 -1
- package/dist/esm/common/FailsafeContext.js +27 -33
- package/dist/esm/common/FailsafeContext.js.map +1 -1
- package/dist/esm/common/FailsafeTimer.d.ts +4 -3
- package/dist/esm/common/FailsafeTimer.d.ts.map +1 -1
- package/dist/esm/common/FailsafeTimer.js +4 -4
- package/dist/esm/common/FailsafeTimer.js.map +1 -1
- package/dist/esm/common/Mark.d.ts +17 -0
- package/dist/esm/common/Mark.d.ts.map +1 -0
- package/dist/esm/common/Mark.js +18 -0
- package/dist/esm/common/Mark.js.map +6 -0
- package/dist/esm/common/index.d.ts +1 -0
- package/dist/esm/common/index.d.ts.map +1 -1
- package/dist/esm/common/index.js +1 -0
- package/dist/esm/common/index.js.map +1 -1
- package/dist/esm/fabric/Fabric.d.ts +16 -8
- package/dist/esm/fabric/Fabric.d.ts.map +1 -1
- package/dist/esm/fabric/Fabric.js +36 -18
- package/dist/esm/fabric/Fabric.js.map +1 -1
- package/dist/esm/fabric/FabricAuthority.d.ts +2 -2
- package/dist/esm/fabric/FabricAuthority.d.ts.map +1 -1
- package/dist/esm/fabric/FabricAuthority.js +5 -5
- package/dist/esm/fabric/FabricAuthority.js.map +1 -1
- package/dist/esm/fabric/FabricManager.d.ts +10 -14
- package/dist/esm/fabric/FabricManager.d.ts.map +1 -1
- package/dist/esm/fabric/FabricManager.js +45 -40
- package/dist/esm/fabric/FabricManager.js.map +2 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interaction/AttributeDataEncoder.d.ts +1 -1
- package/dist/esm/interaction/InteractionClient.d.ts +2 -2
- package/dist/esm/interaction/InteractionClient.d.ts.map +1 -1
- package/dist/esm/interaction/InteractionClient.js +39 -22
- package/dist/esm/interaction/InteractionClient.js.map +1 -1
- package/dist/esm/interaction/InteractionMessenger.d.ts +2 -2
- package/dist/esm/interaction/InteractionMessenger.d.ts.map +1 -1
- package/dist/esm/interaction/InteractionMessenger.js +33 -28
- package/dist/esm/interaction/InteractionMessenger.js.map +1 -1
- package/dist/esm/interaction/Subscription.d.ts +16 -37
- package/dist/esm/interaction/Subscription.d.ts.map +1 -1
- package/dist/esm/interaction/Subscription.js +16 -69
- package/dist/esm/interaction/Subscription.js.map +2 -2
- package/dist/esm/interaction/SubscriptionClient.d.ts +2 -2
- package/dist/esm/interaction/SubscriptionClient.d.ts.map +1 -1
- package/dist/esm/interaction/SubscriptionClient.js +2 -2
- package/dist/esm/interaction/SubscriptionClient.js.map +1 -1
- package/dist/esm/mdns/MdnsClient.d.ts +10 -10
- package/dist/esm/mdns/MdnsClient.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsClient.js +166 -80
- package/dist/esm/mdns/MdnsClient.js.map +1 -1
- package/dist/esm/mdns/MdnsServer.d.ts +2 -2
- package/dist/esm/mdns/MdnsServer.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsServer.js +176 -94
- package/dist/esm/mdns/MdnsServer.js.map +2 -2
- package/dist/esm/mdns/MdnsService.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsService.js +3 -2
- package/dist/esm/mdns/MdnsService.js.map +1 -1
- package/dist/esm/mdns/MdnsSocket.d.ts +3 -2
- package/dist/esm/mdns/MdnsSocket.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsSocket.js +2 -1
- package/dist/esm/mdns/MdnsSocket.js.map +1 -1
- package/dist/esm/peer/ControllerCommissioner.d.ts +2 -2
- package/dist/esm/peer/ControllerCommissioner.d.ts.map +1 -1
- package/dist/esm/peer/ControllerCommissioner.js +26 -28
- package/dist/esm/peer/ControllerCommissioner.js.map +1 -1
- package/dist/esm/peer/ControllerDiscovery.d.ts +1 -1
- package/dist/esm/peer/ControllerDiscovery.d.ts.map +1 -1
- package/dist/esm/peer/ControllerDiscovery.js +1 -1
- package/dist/esm/peer/ControllerDiscovery.js.map +1 -1
- package/dist/esm/peer/Peer.d.ts +57 -0
- package/dist/esm/peer/Peer.d.ts.map +1 -0
- package/dist/esm/peer/Peer.js +162 -0
- package/dist/esm/peer/Peer.js.map +6 -0
- package/dist/esm/peer/PeerAddress.d.ts.map +1 -1
- package/dist/esm/peer/PeerAddress.js +5 -2
- package/dist/esm/peer/PeerAddress.js.map +1 -1
- package/dist/esm/peer/PeerAddressStore.d.ts +3 -3
- package/dist/esm/peer/PeerAddressStore.d.ts.map +1 -1
- package/dist/{cjs/peer/OperationalPeer.d.ts → esm/peer/PeerDescriptor.d.ts} +14 -7
- package/dist/esm/peer/PeerDescriptor.d.ts.map +1 -0
- package/dist/esm/peer/PeerDescriptor.js +51 -0
- package/dist/esm/peer/PeerDescriptor.js.map +6 -0
- package/dist/esm/peer/PeerSet.d.ts +23 -26
- package/dist/esm/peer/PeerSet.d.ts.map +1 -1
- package/dist/esm/peer/PeerSet.js +173 -175
- package/dist/esm/peer/PeerSet.js.map +2 -2
- package/dist/esm/peer/index.d.ts +1 -1
- package/dist/esm/peer/index.d.ts.map +1 -1
- package/dist/esm/peer/index.js +1 -1
- package/dist/esm/protocol/DeviceAdvertiser.js +4 -4
- package/dist/esm/protocol/DeviceAdvertiser.js.map +1 -1
- package/dist/esm/protocol/ExchangeManager.d.ts +6 -9
- package/dist/esm/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/esm/protocol/ExchangeManager.js +308 -251
- package/dist/esm/protocol/ExchangeManager.js.map +2 -2
- package/dist/esm/protocol/ExchangeProvider.d.ts +9 -11
- package/dist/esm/protocol/ExchangeProvider.d.ts.map +1 -1
- package/dist/esm/protocol/ExchangeProvider.js +81 -37
- package/dist/esm/protocol/ExchangeProvider.js.map +2 -2
- package/dist/esm/protocol/MessageChannel.d.ts +6 -7
- package/dist/esm/protocol/MessageChannel.d.ts.map +1 -1
- package/dist/esm/protocol/MessageChannel.js +22 -18
- package/dist/esm/protocol/MessageChannel.js.map +1 -1
- package/dist/esm/protocol/MessageCounter.d.ts +4 -4
- package/dist/esm/protocol/MessageCounter.d.ts.map +1 -1
- package/dist/esm/protocol/MessageCounter.js +7 -7
- package/dist/esm/protocol/MessageCounter.js.map +1 -1
- package/dist/esm/protocol/MessageExchange.d.ts +31 -20
- package/dist/esm/protocol/MessageExchange.d.ts.map +1 -1
- package/dist/esm/protocol/MessageExchange.js +318 -238
- package/dist/esm/protocol/MessageExchange.js.map +2 -2
- package/dist/esm/protocol/ProtocolMocks.d.ts +100 -0
- package/dist/esm/protocol/ProtocolMocks.d.ts.map +1 -0
- package/dist/esm/protocol/ProtocolMocks.js +230 -0
- package/dist/esm/protocol/ProtocolMocks.js.map +6 -0
- package/dist/esm/protocol/errors.d.ts +35 -0
- package/dist/esm/protocol/errors.d.ts.map +1 -0
- package/dist/esm/protocol/errors.js +30 -0
- package/dist/esm/protocol/errors.js.map +6 -0
- package/dist/esm/protocol/index.d.ts +2 -1
- package/dist/esm/protocol/index.d.ts.map +1 -1
- package/dist/esm/protocol/index.js +2 -1
- package/dist/esm/protocol/index.js.map +1 -1
- package/dist/esm/securechannel/SecureChannelMessenger.d.ts +1 -0
- package/dist/esm/securechannel/SecureChannelMessenger.d.ts.map +1 -1
- package/dist/esm/securechannel/SecureChannelMessenger.js +3 -0
- package/dist/esm/securechannel/SecureChannelMessenger.js.map +1 -1
- package/dist/esm/securechannel/SecureChannelProtocol.js +2 -2
- package/dist/esm/securechannel/SecureChannelProtocol.js.map +1 -1
- package/dist/esm/session/GroupSession.d.ts +21 -10
- package/dist/esm/session/GroupSession.d.ts.map +1 -1
- package/dist/esm/session/GroupSession.js +41 -12
- package/dist/esm/session/GroupSession.js.map +1 -1
- package/dist/esm/session/NodeSession.d.ts +56 -50
- package/dist/esm/session/NodeSession.d.ts.map +1 -1
- package/dist/esm/session/NodeSession.js +99 -105
- package/dist/esm/session/NodeSession.js.map +1 -1
- package/dist/esm/session/SecureSession.d.ts +4 -4
- package/dist/esm/session/SecureSession.d.ts.map +1 -1
- package/dist/esm/session/SecureSession.js +1 -1
- package/dist/esm/session/SecureSession.js.map +1 -1
- package/dist/esm/session/Session.d.ts +82 -66
- package/dist/esm/session/Session.d.ts.map +1 -1
- package/dist/esm/session/Session.js +223 -45
- package/dist/esm/session/Session.js.map +1 -1
- package/dist/esm/session/SessionManager.d.ts +33 -36
- package/dist/esm/session/SessionManager.d.ts.map +1 -1
- package/dist/esm/session/SessionManager.js +113 -157
- package/dist/esm/session/SessionManager.js.map +1 -1
- package/dist/esm/session/SessionParameters.d.ts +87 -0
- package/dist/esm/session/SessionParameters.d.ts.map +1 -0
- package/dist/esm/session/SessionParameters.js +61 -0
- package/dist/esm/session/SessionParameters.js.map +6 -0
- package/dist/{cjs/session/InsecureSession.d.ts → esm/session/UnsecuredSession.d.ts} +18 -16
- package/dist/esm/session/UnsecuredSession.d.ts.map +1 -0
- package/dist/esm/session/{InsecureSession.js → UnsecuredSession.js} +18 -18
- package/dist/esm/session/UnsecuredSession.js.map +6 -0
- package/dist/esm/session/case/CaseClient.d.ts.map +1 -1
- package/dist/esm/session/case/CaseClient.js +5 -3
- package/dist/esm/session/case/CaseClient.js.map +1 -1
- package/dist/esm/session/case/CaseServer.d.ts.map +1 -1
- package/dist/esm/session/case/CaseServer.js +14 -10
- package/dist/esm/session/case/CaseServer.js.map +1 -1
- package/dist/esm/session/index.d.ts +2 -1
- package/dist/esm/session/index.d.ts.map +1 -1
- package/dist/esm/session/index.js +2 -1
- package/dist/esm/session/index.js.map +1 -1
- package/dist/esm/session/pase/PaseClient.d.ts +3 -3
- package/dist/esm/session/pase/PaseClient.d.ts.map +1 -1
- package/dist/esm/session/pase/PaseClient.js +5 -3
- package/dist/esm/session/pase/PaseClient.js.map +1 -1
- package/dist/esm/session/pase/PaseServer.d.ts.map +1 -1
- package/dist/esm/session/pase/PaseServer.js +13 -13
- package/dist/esm/session/pase/PaseServer.js.map +1 -1
- package/package.json +6 -6
- package/src/action/client/ClientInteraction.ts +47 -13
- package/src/action/client/subscription/ClientSubscription.ts +30 -5
- package/src/action/client/subscription/ClientSubscriptionHandler.ts +2 -4
- package/src/action/client/subscription/ClientSubscriptions.ts +14 -3
- package/src/action/client/subscription/PeerSubscription.ts +2 -2
- package/src/action/client/subscription/SustainedSubscription.ts +2 -6
- package/src/action/request/Invoke.ts +2 -2
- package/src/action/server/AttributeReadResponse.ts +2 -0
- package/src/action/server/AttributeWriteResponse.ts +2 -0
- package/src/action/server/CommandInvokeResponse.ts +1 -0
- package/src/action/server/DataResponse.ts +4 -0
- package/src/action/server/ServerInteraction.ts +4 -4
- package/src/advertisement/Advertisement.ts +6 -7
- package/src/advertisement/Advertiser.ts +12 -1
- package/src/advertisement/ble/BleAdvertiser.ts +7 -2
- package/src/advertisement/mdns/MdnsAdvertiser.ts +7 -1
- package/src/certificate/kinds/definitions/asn.ts +2 -2
- package/src/certificate/kinds/definitions/attestation.ts +1 -0
- package/src/cluster/client/AttributeClient.ts +1 -1
- package/src/codec/MessageCodec.ts +39 -32
- package/src/common/FailsafeContext.ts +36 -39
- package/src/common/FailsafeTimer.ts +7 -6
- package/src/common/Mark.ts +17 -0
- package/src/common/index.ts +1 -0
- package/src/fabric/Fabric.ts +51 -23
- package/src/fabric/FabricAuthority.ts +4 -4
- package/src/fabric/FabricManager.ts +53 -40
- package/src/index.ts +3 -1
- package/src/interaction/InteractionClient.ts +40 -23
- package/src/interaction/InteractionMessenger.ts +38 -32
- package/src/interaction/Subscription.ts +20 -92
- package/src/interaction/SubscriptionClient.ts +3 -3
- package/src/mdns/MdnsClient.ts +20 -3
- package/src/mdns/MdnsServer.ts +13 -1
- package/src/mdns/MdnsService.ts +3 -2
- package/src/mdns/MdnsSocket.ts +9 -3
- package/src/peer/ControllerCommissioner.ts +35 -37
- package/src/peer/ControllerDiscovery.ts +1 -1
- package/src/peer/Peer.ts +161 -0
- package/src/peer/PeerAddress.ts +6 -2
- package/src/peer/PeerAddressStore.ts +3 -3
- package/src/peer/PeerDescriptor.ts +89 -0
- package/src/peer/PeerSet.ts +145 -213
- package/src/peer/index.ts +1 -1
- package/src/protocol/DeviceAdvertiser.ts +4 -4
- package/src/protocol/ExchangeManager.ts +161 -181
- package/src/protocol/ExchangeProvider.ts +31 -40
- package/src/protocol/MessageChannel.ts +29 -18
- package/src/protocol/MessageCounter.ts +8 -8
- package/src/protocol/MessageExchange.ts +181 -144
- package/src/protocol/ProtocolMocks.ts +302 -0
- package/src/protocol/errors.ts +44 -0
- package/src/protocol/index.ts +2 -1
- package/src/securechannel/SecureChannelMessenger.ts +4 -0
- package/src/securechannel/SecureChannelProtocol.ts +2 -2
- package/src/session/GroupSession.ts +67 -23
- package/src/session/NodeSession.ts +140 -136
- package/src/session/SecureSession.ts +6 -5
- package/src/session/Session.ts +234 -101
- package/src/session/SessionManager.ts +148 -187
- package/src/session/SessionParameters.ts +108 -0
- package/src/session/{InsecureSession.ts → UnsecuredSession.ts} +28 -26
- package/src/session/case/CaseClient.ts +6 -3
- package/src/session/case/CaseServer.ts +15 -11
- package/src/session/index.ts +2 -1
- package/src/session/pase/PaseClient.ts +12 -5
- package/src/session/pase/PaseServer.ts +14 -13
- package/dist/cjs/peer/OperationalPeer.d.ts.map +0 -1
- package/dist/cjs/peer/OperationalPeer.js.map +0 -6
- package/dist/cjs/protocol/ChannelManager.d.ts +0 -29
- package/dist/cjs/protocol/ChannelManager.d.ts.map +0 -1
- package/dist/cjs/protocol/ChannelManager.js +0 -178
- package/dist/cjs/protocol/ChannelManager.js.map +0 -6
- package/dist/cjs/session/InsecureSession.d.ts.map +0 -1
- package/dist/cjs/session/InsecureSession.js.map +0 -6
- package/dist/esm/peer/OperationalPeer.d.ts +0 -38
- package/dist/esm/peer/OperationalPeer.d.ts.map +0 -1
- package/dist/esm/peer/OperationalPeer.js +0 -6
- package/dist/esm/peer/OperationalPeer.js.map +0 -6
- package/dist/esm/protocol/ChannelManager.d.ts +0 -29
- package/dist/esm/protocol/ChannelManager.d.ts.map +0 -1
- package/dist/esm/protocol/ChannelManager.js +0 -158
- package/dist/esm/protocol/ChannelManager.js.map +0 -6
- package/dist/esm/session/InsecureSession.d.ts.map +0 -1
- package/dist/esm/session/InsecureSession.js.map +0 -6
- package/src/protocol/ChannelManager.ts +0 -180
package/dist/esm/peer/PeerSet.js
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
2
|
+
var __typeError = (msg) => {
|
|
3
|
+
throw TypeError(msg);
|
|
4
|
+
};
|
|
5
|
+
var __using = (stack, value, async) => {
|
|
6
|
+
if (value != null) {
|
|
7
|
+
if (typeof value !== "object" && typeof value !== "function") __typeError("Object expected");
|
|
8
|
+
var dispose, inner;
|
|
9
|
+
if (async) dispose = value[__knownSymbol("asyncDispose")];
|
|
10
|
+
if (dispose === void 0) {
|
|
11
|
+
dispose = value[__knownSymbol("dispose")];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") __typeError("Object not disposable");
|
|
15
|
+
if (inner) dispose = function() {
|
|
16
|
+
try {
|
|
17
|
+
inner.call(this);
|
|
18
|
+
} catch (e) {
|
|
19
|
+
return Promise.reject(e);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
stack.push([async, dispose, value]);
|
|
23
|
+
} else if (async) {
|
|
24
|
+
stack.push([async]);
|
|
25
|
+
}
|
|
26
|
+
return value;
|
|
27
|
+
};
|
|
28
|
+
var __callDispose = (stack, error, hasError) => {
|
|
29
|
+
var E = typeof SuppressedError === "function" ? SuppressedError : function(e, s, m, _) {
|
|
30
|
+
return _ = Error(m), _.name = "SuppressedError", _.error = e, _.suppressed = s, _;
|
|
31
|
+
};
|
|
32
|
+
var fail = (e) => error = hasError ? new E(e, error, "An error was suppressed during disposal") : (hasError = true, e);
|
|
33
|
+
var next = (it) => {
|
|
34
|
+
while (it = stack.pop()) {
|
|
35
|
+
try {
|
|
36
|
+
var result = it[1] && it[1].call(it[2]);
|
|
37
|
+
if (it[0]) return Promise.resolve(result).then(next, (e) => (fail(e), next()));
|
|
38
|
+
} catch (e) {
|
|
39
|
+
fail(e);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (hasError) throw error;
|
|
43
|
+
};
|
|
44
|
+
return next();
|
|
45
|
+
};
|
|
1
46
|
/**
|
|
2
47
|
* @license
|
|
3
48
|
* Copyright 2022-2025 Matter.js Authors
|
|
@@ -15,7 +60,6 @@ import {
|
|
|
15
60
|
Duration,
|
|
16
61
|
Environmental,
|
|
17
62
|
ImplementationError,
|
|
18
|
-
isIpNetworkChannel,
|
|
19
63
|
isIPv6,
|
|
20
64
|
Logger,
|
|
21
65
|
MatterError,
|
|
@@ -23,21 +67,20 @@ import {
|
|
|
23
67
|
NoResponseTimeoutError,
|
|
24
68
|
Seconds,
|
|
25
69
|
ServerAddress,
|
|
26
|
-
STANDARD_MATTER_PORT,
|
|
27
70
|
Time
|
|
28
71
|
} from "#general";
|
|
29
72
|
import { PeerAddress, PeerAddressMap } from "#peer/PeerAddress.js";
|
|
30
|
-
import {
|
|
73
|
+
import { RetransmissionLimitReachedError } from "#protocol/errors.js";
|
|
31
74
|
import { ExchangeManager } from "#protocol/ExchangeManager.js";
|
|
32
75
|
import { DedicatedChannelExchangeProvider, ReconnectableExchangeProvider } from "#protocol/ExchangeProvider.js";
|
|
33
|
-
import { ChannelNotConnectedError, MessageChannel } from "#protocol/MessageChannel.js";
|
|
34
|
-
import { RetransmissionLimitReachedError } from "#protocol/MessageExchange.js";
|
|
35
76
|
import { ChannelStatusResponseError } from "#securechannel/SecureChannelMessenger.js";
|
|
36
77
|
import { CaseClient } from "#session/case/CaseClient.js";
|
|
78
|
+
import { SecureSession } from "#session/SecureSession.js";
|
|
37
79
|
import { SessionManager } from "#session/SessionManager.js";
|
|
38
|
-
import {
|
|
80
|
+
import { NodeId, SECURE_CHANNEL_PROTOCOL_ID, SecureChannelStatusCode } from "#types";
|
|
39
81
|
import { ControllerDiscovery, DiscoveryError, PairRetransmissionLimitReachedError } from "./ControllerDiscovery.js";
|
|
40
82
|
import { InteractionQueue } from "./InteractionQueue.js";
|
|
83
|
+
import { Peer } from "./Peer.js";
|
|
41
84
|
import { PeerAddressStore } from "./PeerAddressStore.js";
|
|
42
85
|
const logger = Logger.get("PeerSet");
|
|
43
86
|
const RECONNECTION_POLLING_INTERVAL = Minutes(10);
|
|
@@ -52,37 +95,42 @@ var NodeDiscoveryType = /* @__PURE__ */ ((NodeDiscoveryType2) => {
|
|
|
52
95
|
class UnknownNodeError extends MatterError {
|
|
53
96
|
}
|
|
54
97
|
class PeerSet {
|
|
98
|
+
#lifetime;
|
|
55
99
|
#sessions;
|
|
56
|
-
#channels;
|
|
57
100
|
#exchanges;
|
|
58
101
|
#scanners;
|
|
59
102
|
#transports;
|
|
60
103
|
#caseClient;
|
|
61
104
|
#peers = new BasicSet();
|
|
62
|
-
#peersByAddress = new PeerAddressMap();
|
|
63
|
-
#runningPeerDiscoveries = new PeerAddressMap();
|
|
64
|
-
#runningPeerReconnections = new PeerAddressMap();
|
|
65
105
|
#construction;
|
|
66
106
|
#store;
|
|
67
107
|
#interactionQueue = new InteractionQueue();
|
|
68
108
|
#nodeCachedData = new PeerAddressMap();
|
|
69
109
|
// Temporarily until we store it in new API
|
|
70
110
|
#disconnected = AsyncObservable();
|
|
111
|
+
#peerContext;
|
|
71
112
|
constructor(context) {
|
|
72
|
-
const {
|
|
113
|
+
const { lifetime, sessions, exchanges, scanners, transports: netInterfaces, store } = context;
|
|
114
|
+
this.#lifetime = lifetime.join("peers");
|
|
73
115
|
this.#sessions = sessions;
|
|
74
|
-
this.#channels = channels;
|
|
75
116
|
this.#exchanges = exchanges;
|
|
76
117
|
this.#scanners = scanners;
|
|
77
118
|
this.#transports = netInterfaces;
|
|
78
119
|
this.#store = store;
|
|
79
120
|
this.#caseClient = new CaseClient(this.#sessions);
|
|
121
|
+
this.#peerContext = {
|
|
122
|
+
lifetime: this.#lifetime,
|
|
123
|
+
sessions,
|
|
124
|
+
savePeer: (peer) => this.#store.updatePeer(peer.descriptor),
|
|
125
|
+
deletePeer: (peer) => this.#store.deletePeer(peer.address),
|
|
126
|
+
closed: (peer) => this.#peers.delete(peer)
|
|
127
|
+
};
|
|
80
128
|
this.#peers.added.on((peer) => {
|
|
81
|
-
peer.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
129
|
+
peer.sessions.deleted.on(() => {
|
|
130
|
+
if (!peer.sessions.size) {
|
|
131
|
+
this.#disconnected.emit(peer);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
86
134
|
});
|
|
87
135
|
this.#sessions.retry.on((session, count) => {
|
|
88
136
|
if (count !== 1) {
|
|
@@ -90,14 +138,9 @@ class PeerSet {
|
|
|
90
138
|
}
|
|
91
139
|
this.#handleFirstRetry(session);
|
|
92
140
|
});
|
|
93
|
-
this.#channels.added.on((address, msgChannel) => {
|
|
94
|
-
if (isIpNetworkChannel(msgChannel.channel)) {
|
|
95
|
-
return this.#addOrUpdatePeer(address, msgChannel.channel.networkAddress);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
141
|
this.#construction = Construction(this, async () => {
|
|
99
|
-
for (const
|
|
100
|
-
this.#peers.add(
|
|
142
|
+
for (const descriptor of await this.#store.loadPeers()) {
|
|
143
|
+
this.#peers.add(new Peer(descriptor, this.#peerContext));
|
|
101
144
|
}
|
|
102
145
|
});
|
|
103
146
|
}
|
|
@@ -113,11 +156,22 @@ class PeerSet {
|
|
|
113
156
|
get disconnected() {
|
|
114
157
|
return this.#disconnected;
|
|
115
158
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Unconditional get.
|
|
161
|
+
*
|
|
162
|
+
* Creates the peer if not already present.
|
|
163
|
+
*/
|
|
164
|
+
for(address) {
|
|
165
|
+
let peer = this.get(address);
|
|
166
|
+
if (peer) {
|
|
167
|
+
return peer;
|
|
119
168
|
}
|
|
120
|
-
|
|
169
|
+
peer = new Peer({ address }, this.#peerContext);
|
|
170
|
+
this.#peers.add(peer);
|
|
171
|
+
return peer;
|
|
172
|
+
}
|
|
173
|
+
has(item) {
|
|
174
|
+
return !!this.get(item);
|
|
121
175
|
}
|
|
122
176
|
get size() {
|
|
123
177
|
return this.#peers.size;
|
|
@@ -139,8 +193,8 @@ class PeerSet {
|
|
|
139
193
|
}
|
|
140
194
|
static [Environmental.create](env) {
|
|
141
195
|
const instance = new PeerSet({
|
|
196
|
+
lifetime: env,
|
|
142
197
|
sessions: env.get(SessionManager),
|
|
143
|
-
channels: env.get(ChannelManager),
|
|
144
198
|
exchanges: env.get(ExchangeManager),
|
|
145
199
|
scanners: env.get(ScannerSet),
|
|
146
200
|
transports: env.get(ConnectionlessTransportSet),
|
|
@@ -163,29 +217,31 @@ class PeerSet {
|
|
|
163
217
|
*/
|
|
164
218
|
async #ensureConnection(address, options) {
|
|
165
219
|
address = PeerAddress(address);
|
|
166
|
-
|
|
220
|
+
if (PeerAddress.isGroup(address)) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
167
223
|
const { allowUnknownPeer, operationalAddress } = options;
|
|
168
|
-
if (!this
|
|
224
|
+
if (!this.has(address) && !allowUnknownPeer) {
|
|
169
225
|
throw new UnknownNodeError(`Cannot connect to unknown device ${PeerAddress(address)}`);
|
|
170
226
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
227
|
+
const peer = this.for(address);
|
|
228
|
+
if (this.#sessions.maybeSessionFor(address) || peer.activeDiscovery?.type === 3 /* FullDiscovery */) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const { promise: existingReconnectPromise } = peer.activeReconnection ?? {};
|
|
232
|
+
if (existingReconnectPromise !== void 0) {
|
|
233
|
+
return existingReconnectPromise;
|
|
234
|
+
}
|
|
235
|
+
const { promise, resolver, rejecter } = createPromise();
|
|
236
|
+
peer.activeReconnection = { promise, rejecter };
|
|
237
|
+
this.#resume(address, options, operationalAddress).then((channel) => {
|
|
238
|
+
peer.activeReconnection = void 0;
|
|
239
|
+
resolver(channel);
|
|
240
|
+
}).catch((error) => {
|
|
241
|
+
peer.activeReconnection = void 0;
|
|
242
|
+
rejecter(error);
|
|
243
|
+
});
|
|
244
|
+
if (options.discoveryOptions?.discoveryType !== 3 /* FullDiscovery */) {
|
|
189
245
|
return promise;
|
|
190
246
|
}
|
|
191
247
|
}
|
|
@@ -193,49 +249,46 @@ class PeerSet {
|
|
|
193
249
|
* Obtain an exchange provider for the designated peer.
|
|
194
250
|
* TODO enhance PeerConnectionOptions.discoveryOptions.discoveryData with "addresses" for known operational addresses
|
|
195
251
|
*/
|
|
196
|
-
async exchangeProviderFor(
|
|
197
|
-
if (
|
|
198
|
-
return new DedicatedChannelExchangeProvider(this.#exchanges,
|
|
252
|
+
async exchangeProviderFor(addressOrSession, options = {}) {
|
|
253
|
+
if (addressOrSession instanceof SecureSession) {
|
|
254
|
+
return new DedicatedChannelExchangeProvider(this.#exchanges, addressOrSession);
|
|
199
255
|
}
|
|
200
|
-
const address =
|
|
256
|
+
const address = addressOrSession;
|
|
201
257
|
if (PeerAddress.isGroup(address)) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
return new DedicatedChannelExchangeProvider(this.#exchanges, this.#channels.getChannel(address));
|
|
258
|
+
const session = await this.#sessions.groupSessionForAddress(address, this.#transports);
|
|
259
|
+
return new DedicatedChannelExchangeProvider(this.#exchanges, session);
|
|
206
260
|
}
|
|
207
|
-
let initiallyConnected = this.#
|
|
208
|
-
return new ReconnectableExchangeProvider(this.#exchanges, this.#
|
|
261
|
+
let initiallyConnected = !!this.#sessions.maybeSessionFor(address);
|
|
262
|
+
return new ReconnectableExchangeProvider(this.#exchanges, this.#sessions, address, async () => {
|
|
209
263
|
const { caseAuthenticatedTags, discoveryOptions } = options;
|
|
210
|
-
if (!initiallyConnected && !this.#
|
|
264
|
+
if (!initiallyConnected && !this.#sessions.maybeSessionFor(address)) {
|
|
211
265
|
await this.#ensureConnection(address, {
|
|
212
266
|
discoveryOptions: { discoveryType: 0 /* None */ },
|
|
213
267
|
caseAuthenticatedTags
|
|
214
268
|
});
|
|
215
269
|
initiallyConnected = true;
|
|
216
|
-
if (this.#
|
|
270
|
+
if (this.#sessions.maybeSessionFor(address)) {
|
|
217
271
|
return;
|
|
218
272
|
}
|
|
219
273
|
}
|
|
220
|
-
if (!this.#
|
|
221
|
-
throw new RetransmissionLimitReachedError(`Device ${PeerAddress(address)} is
|
|
274
|
+
if (!this.#sessions.maybeSessionFor(address)) {
|
|
275
|
+
throw new RetransmissionLimitReachedError(`Device ${PeerAddress(address)} is unreachable`);
|
|
222
276
|
}
|
|
223
|
-
await this.#
|
|
277
|
+
await this.#sessions.handlePeerLoss(address);
|
|
224
278
|
const { discoveryData } = discoveryOptions ?? {
|
|
225
|
-
discoveryData: this
|
|
279
|
+
discoveryData: this.get(address)?.descriptor.discoveryData
|
|
226
280
|
};
|
|
227
281
|
const operationalAddress = this.#knownOperationalAddressFor(address, true);
|
|
228
282
|
if (operationalAddress === void 0) {
|
|
229
283
|
logger.info(
|
|
230
284
|
`Re-discovering device failed (no address found), remove all sessions for ${PeerAddress(address)}`
|
|
231
285
|
);
|
|
232
|
-
await this.#sessions.removeAllSessionsForNode(address);
|
|
233
286
|
throw new RetransmissionLimitReachedError(`No operational address found for ${PeerAddress(address)}`);
|
|
234
287
|
}
|
|
235
288
|
if (await this.#reconnectKnownAddress(address, operationalAddress, discoveryData, {
|
|
236
289
|
expectedProcessingTime: Seconds(2)
|
|
237
290
|
}) === void 0) {
|
|
238
|
-
throw new RetransmissionLimitReachedError(`${PeerAddress(address)} is not reachable
|
|
291
|
+
throw new RetransmissionLimitReachedError(`${PeerAddress(address)} is not reachable`);
|
|
239
292
|
}
|
|
240
293
|
});
|
|
241
294
|
}
|
|
@@ -244,55 +297,23 @@ class PeerSet {
|
|
|
244
297
|
*/
|
|
245
298
|
get(peer) {
|
|
246
299
|
if ("address" in peer) {
|
|
247
|
-
return this.#
|
|
248
|
-
}
|
|
249
|
-
return this.#peersByAddress.get(peer);
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Terminate any active peer connection.
|
|
253
|
-
* Also handles unknown peers
|
|
254
|
-
*/
|
|
255
|
-
async disconnect(peer, sendSessionClose = true) {
|
|
256
|
-
let address = this.get(peer)?.address;
|
|
257
|
-
if (address === void 0) {
|
|
258
|
-
if ("nodeId" in peer && "fabricIndex" in peer) {
|
|
259
|
-
address = peer;
|
|
260
|
-
} else {
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
await this.#sessions.removeAllSessionsForNode(address, sendSessionClose);
|
|
265
|
-
await this.#channels.removeAllNodeChannels(address);
|
|
266
|
-
await this.#disconnected.emit(address);
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Forget a known peer.
|
|
270
|
-
*/
|
|
271
|
-
async delete(peer) {
|
|
272
|
-
const actual = this.get(peer);
|
|
273
|
-
if (actual === void 0) {
|
|
274
|
-
return;
|
|
300
|
+
return this.#peers.get("address", PeerAddress(peer.address));
|
|
275
301
|
}
|
|
276
|
-
|
|
277
|
-
logger.info(`Removing ${address}`);
|
|
278
|
-
this.#peers.delete(actual);
|
|
279
|
-
await this.#store.deletePeer(address);
|
|
280
|
-
await this.disconnect(address, false);
|
|
281
|
-
await this.#sessions.deleteResumptionRecord(address);
|
|
302
|
+
return this.#peers.get("address", PeerAddress(peer));
|
|
282
303
|
}
|
|
283
304
|
async close() {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
305
|
+
var _stack = [];
|
|
306
|
+
try {
|
|
307
|
+
const _closing = __using(_stack, this.#lifetime.closing());
|
|
308
|
+
for (const peer of this.#peers) {
|
|
309
|
+
await peer.close();
|
|
310
|
+
}
|
|
311
|
+
this.#interactionQueue.close();
|
|
312
|
+
} catch (_) {
|
|
313
|
+
var _error = _, _hasError = true;
|
|
314
|
+
} finally {
|
|
315
|
+
__callDispose(_stack, _error, _hasError);
|
|
290
316
|
}
|
|
291
|
-
this.#interactionQueue.close();
|
|
292
|
-
this.#runningPeerReconnections.forEach(
|
|
293
|
-
({ rejecter }) => rejecter(new ChannelNotConnectedError("PeerSet closed"))
|
|
294
|
-
);
|
|
295
|
-
this.#runningPeerReconnections.clear();
|
|
296
317
|
}
|
|
297
318
|
/**
|
|
298
319
|
* Resume a device connection and establish a CASE session that was previously paired with the controller. This
|
|
@@ -306,9 +327,9 @@ class PeerSet {
|
|
|
306
327
|
try {
|
|
307
328
|
return await this.#connectOrDiscoverNode(address, operationalAddress, options);
|
|
308
329
|
} catch (error) {
|
|
309
|
-
if ((error instanceof DiscoveryError || error instanceof NoResponseTimeoutError) && this
|
|
330
|
+
if ((error instanceof DiscoveryError || error instanceof NoResponseTimeoutError) && this.has(address) && tryOperationalAddress === void 0) {
|
|
310
331
|
logger.info(`Resume failed, remove all sessions for ${PeerAddress(address)}`);
|
|
311
|
-
await this.#sessions.
|
|
332
|
+
await this.#sessions.handlePeerLoss(address);
|
|
312
333
|
}
|
|
313
334
|
throw error;
|
|
314
335
|
}
|
|
@@ -319,7 +340,7 @@ class PeerSet {
|
|
|
319
340
|
discoveryOptions: {
|
|
320
341
|
discoveryType: requestedDiscoveryType = 3 /* FullDiscovery */,
|
|
321
342
|
timeout,
|
|
322
|
-
discoveryData = this
|
|
343
|
+
discoveryData = this.get(address)?.descriptor.discoveryData
|
|
323
344
|
} = {},
|
|
324
345
|
caseAuthenticatedTags
|
|
325
346
|
} = options ?? {};
|
|
@@ -333,12 +354,13 @@ class PeerSet {
|
|
|
333
354
|
if (!mdnsScanner) {
|
|
334
355
|
throw new ImplementationError("Cannot discover device without mDNS scanner.");
|
|
335
356
|
}
|
|
336
|
-
const
|
|
357
|
+
const peer = this.for(address);
|
|
358
|
+
const existingDiscoveryDetails = peer.activeDiscovery ?? {
|
|
337
359
|
type: 0 /* None */
|
|
338
360
|
};
|
|
339
361
|
if (existingDiscoveryDetails.type !== 0 /* None */ && existingDiscoveryDetails.type < requestedDiscoveryType) {
|
|
340
362
|
mdnsScanner.cancelOperationalDeviceDiscovery(this.#sessions.fabricFor(address), address.nodeId);
|
|
341
|
-
|
|
363
|
+
peer.activeDiscovery = void 0;
|
|
342
364
|
existingDiscoveryDetails.type = 0 /* None */;
|
|
343
365
|
}
|
|
344
366
|
const { type: runningDiscoveryType, promises } = existingDiscoveryDetails;
|
|
@@ -395,7 +417,7 @@ class PeerSet {
|
|
|
395
417
|
this.#sessions.fabricFor(address),
|
|
396
418
|
address.nodeId
|
|
397
419
|
);
|
|
398
|
-
|
|
420
|
+
peer.activeDiscovery = void 0;
|
|
399
421
|
resolver(result);
|
|
400
422
|
}
|
|
401
423
|
} catch (error) {
|
|
@@ -405,7 +427,7 @@ class PeerSet {
|
|
|
405
427
|
this.#sessions.fabricFor(address),
|
|
406
428
|
address.nodeId
|
|
407
429
|
);
|
|
408
|
-
|
|
430
|
+
peer.activeDiscovery = void 0;
|
|
409
431
|
rejecter(error);
|
|
410
432
|
}
|
|
411
433
|
}
|
|
@@ -427,9 +449,9 @@ class PeerSet {
|
|
|
427
449
|
timeout,
|
|
428
450
|
timeout === void 0
|
|
429
451
|
);
|
|
430
|
-
const { stopTimerFunc: stopTimerFunc2 } =
|
|
452
|
+
const { stopTimerFunc: stopTimerFunc2 } = peer.activeDiscovery ?? {};
|
|
431
453
|
stopTimerFunc2?.();
|
|
432
|
-
|
|
454
|
+
peer.activeDiscovery = void 0;
|
|
433
455
|
const { result } = await ControllerDiscovery.iterateServerAddresses(
|
|
434
456
|
[scanResult],
|
|
435
457
|
NoResponseTimeoutError,
|
|
@@ -440,25 +462,25 @@ class PeerSet {
|
|
|
440
462
|
);
|
|
441
463
|
return device !== void 0 ? [device] : [];
|
|
442
464
|
},
|
|
443
|
-
async (operationalAddress2,
|
|
444
|
-
const result2 = await this.#pair(address, operationalAddress2,
|
|
465
|
+
async (operationalAddress2, peer2) => {
|
|
466
|
+
const result2 = await this.#pair(address, operationalAddress2, peer2, { caseAuthenticatedTags });
|
|
445
467
|
await this.#addOrUpdatePeer(address, operationalAddress2, {
|
|
446
468
|
...discoveryData,
|
|
447
|
-
...
|
|
469
|
+
...peer2
|
|
448
470
|
});
|
|
449
471
|
return result2;
|
|
450
472
|
}
|
|
451
473
|
);
|
|
452
474
|
return result;
|
|
453
475
|
});
|
|
454
|
-
|
|
476
|
+
peer.activeDiscovery = {
|
|
455
477
|
type: requestedDiscoveryType,
|
|
456
478
|
promises: discoveryPromises,
|
|
457
479
|
stopTimerFunc,
|
|
458
480
|
mdnsClient: mdnsScanner
|
|
459
|
-
}
|
|
481
|
+
};
|
|
460
482
|
return await anyPromise(discoveryPromises).finally(() => {
|
|
461
|
-
|
|
483
|
+
peer.activeDiscovery = void 0;
|
|
462
484
|
});
|
|
463
485
|
}
|
|
464
486
|
async #reconnectKnownAddress(address, operationalAddress, discoveryData, options) {
|
|
@@ -470,40 +492,22 @@ class PeerSet {
|
|
|
470
492
|
logger.debug(
|
|
471
493
|
`Resuming connection to ${PeerAddress(address)} at ${ip}:${port}${expectedProcessingTime !== void 0 ? ` with expected processing time of ${Duration.format(expectedProcessingTime)}` : ""}`
|
|
472
494
|
);
|
|
473
|
-
const
|
|
495
|
+
const session = await this.#pair(address, operationalAddress, discoveryData, options);
|
|
474
496
|
await this.#addOrUpdatePeer(address, operationalAddress);
|
|
475
|
-
return
|
|
497
|
+
return session;
|
|
476
498
|
} catch (error) {
|
|
477
|
-
if (error instanceof NoResponseTimeoutError) {
|
|
499
|
+
if (error instanceof NoResponseTimeoutError || error instanceof ChannelStatusResponseError) {
|
|
478
500
|
logger.debug(
|
|
479
501
|
`Failed to resume connection to ${address} connection with ${ip}:${port}, discovering the node now:`,
|
|
480
502
|
error.message ? error.message : error
|
|
481
503
|
);
|
|
482
|
-
await this.#sessions.
|
|
504
|
+
await this.#sessions.handlePeerLoss(address, startTime);
|
|
483
505
|
return void 0;
|
|
484
506
|
} else {
|
|
485
507
|
throw error;
|
|
486
508
|
}
|
|
487
509
|
}
|
|
488
510
|
}
|
|
489
|
-
async #createGroupChannel(address) {
|
|
490
|
-
const groupId = GroupId.fromNodeId(address.nodeId);
|
|
491
|
-
GroupId.assertGroupId(groupId);
|
|
492
|
-
const multicastAddress = this.#sessions.fabricFor(address).groups.multicastAddressFor(groupId);
|
|
493
|
-
const operationalInterface = this.#transports.interfaceFor(ChannelType.UDP, multicastAddress);
|
|
494
|
-
if (operationalInterface === void 0) {
|
|
495
|
-
throw new PairRetransmissionLimitReachedError(`IPv6 interface not initialized`);
|
|
496
|
-
}
|
|
497
|
-
const operationalChannel = await operationalInterface.openChannel({
|
|
498
|
-
type: ChannelType.UDP,
|
|
499
|
-
ip: multicastAddress,
|
|
500
|
-
port: STANDARD_MATTER_PORT
|
|
501
|
-
});
|
|
502
|
-
const session = this.#sessions.groupSessionForAddress(address);
|
|
503
|
-
const channel = new MessageChannel(operationalChannel, session);
|
|
504
|
-
await this.#channels.setChannel(address, channel);
|
|
505
|
-
return channel;
|
|
506
|
-
}
|
|
507
511
|
/** Pair with an operational device (already commissioned) and establish a CASE session. */
|
|
508
512
|
async #pair(address, operationalServerAddress, discoveryData, options) {
|
|
509
513
|
logger.debug(`Pair with ${address} at ${ServerAddress.urlFor(operationalServerAddress)}`);
|
|
@@ -517,7 +521,8 @@ class PeerSet {
|
|
|
517
521
|
}
|
|
518
522
|
const operationalChannel = await operationalInterface.openChannel(operationalServerAddress);
|
|
519
523
|
const { sessionParameters } = this.#sessions.findResumptionRecordByAddress(address) ?? {};
|
|
520
|
-
const
|
|
524
|
+
const unsecuredSession = this.#sessions.createUnsecuredSession({
|
|
525
|
+
channel: operationalChannel,
|
|
521
526
|
// Use the session parameters from MDNS announcements when available and rest is assumed to be fallbacks
|
|
522
527
|
sessionParameters: {
|
|
523
528
|
...sessionParameters,
|
|
@@ -528,26 +533,19 @@ class PeerSet {
|
|
|
528
533
|
isInitiator: true
|
|
529
534
|
});
|
|
530
535
|
try {
|
|
531
|
-
|
|
532
|
-
new MessageChannel(operationalChannel, unsecureSession),
|
|
533
|
-
address,
|
|
534
|
-
options
|
|
535
|
-
);
|
|
536
|
-
const channel = new MessageChannel(operationalChannel, operationalSecureSession);
|
|
537
|
-
await this.#channels.setChannel(address, channel);
|
|
538
|
-
return channel;
|
|
536
|
+
return await this.#doCasePair(unsecuredSession, address, options);
|
|
539
537
|
} catch (error) {
|
|
540
538
|
NoResponseTimeoutError.accept(error);
|
|
541
539
|
throw new PairRetransmissionLimitReachedError(error.message);
|
|
542
540
|
} finally {
|
|
543
|
-
await
|
|
541
|
+
await unsecuredSession.initiateClose();
|
|
544
542
|
}
|
|
545
543
|
}
|
|
546
|
-
async #doCasePair(
|
|
544
|
+
async #doCasePair(paseSession, address, options) {
|
|
547
545
|
const fabric = this.#sessions.fabricFor(address);
|
|
548
546
|
let exchange;
|
|
549
547
|
try {
|
|
550
|
-
exchange = this.#exchanges.
|
|
548
|
+
exchange = this.#exchanges.initiateExchangeForSession(paseSession, SECURE_CHANNEL_PROTOCOL_ID);
|
|
551
549
|
const { session, resumed } = await this.#caseClient.pair(exchange, fabric, address.nodeId, options);
|
|
552
550
|
if (!resumed) {
|
|
553
551
|
this.#nodeCachedData.delete(address);
|
|
@@ -560,7 +558,7 @@ class PeerSet {
|
|
|
560
558
|
logger.info(
|
|
561
559
|
`Case client: Resumption record seems outdated for Fabric ${NodeId.toHexString(fabric.nodeId)} (index ${fabric.fabricIndex}) and PeerNode ${NodeId.toHexString(address.nodeId)}. Retrying pairing without resumption...`
|
|
562
560
|
);
|
|
563
|
-
return await this.#doCasePair(
|
|
561
|
+
return await this.#doCasePair(paseSession, address, options);
|
|
564
562
|
}
|
|
565
563
|
}
|
|
566
564
|
throw error;
|
|
@@ -587,22 +585,21 @@ class PeerSet {
|
|
|
587
585
|
return discoveredAddresses?.addresses[0];
|
|
588
586
|
}
|
|
589
587
|
async #addOrUpdatePeer(address, operationalServerAddress, discoveryData) {
|
|
590
|
-
let peer = this
|
|
588
|
+
let peer = this.get(address);
|
|
591
589
|
if (peer === void 0) {
|
|
592
|
-
peer = { address, dataStore: await this.#store.createNodeStore(address) };
|
|
590
|
+
peer = new Peer({ address, dataStore: await this.#store.createNodeStore(address) }, this.#peerContext);
|
|
593
591
|
this.#peers.add(peer);
|
|
594
592
|
}
|
|
595
|
-
peer.operationalAddress = operationalServerAddress ?? peer.operationalAddress;
|
|
593
|
+
peer.descriptor.operationalAddress = operationalServerAddress ?? peer.descriptor.operationalAddress;
|
|
596
594
|
if (discoveryData !== void 0) {
|
|
597
|
-
peer.discoveryData = {
|
|
598
|
-
...peer.discoveryData,
|
|
595
|
+
peer.descriptor.discoveryData = {
|
|
596
|
+
...peer.descriptor.discoveryData,
|
|
599
597
|
...discoveryData
|
|
600
598
|
};
|
|
601
599
|
}
|
|
602
|
-
|
|
603
|
-
if (peer.operationalAddress !== void 0 && this.#runningPeerDiscoveries.has(address)) {
|
|
600
|
+
if (peer.descriptor.operationalAddress !== void 0 && peer.activeDiscovery) {
|
|
604
601
|
logger.info(`Found ${address} during discovery, cancel discovery.`);
|
|
605
|
-
const { mdnsClient: mdnsScanner } =
|
|
602
|
+
const { mdnsClient: mdnsScanner } = peer.activeDiscovery ?? {};
|
|
606
603
|
mdnsScanner?.cancelOperationalDeviceDiscovery(this.#sessions.fabricFor(address), address.nodeId, true);
|
|
607
604
|
}
|
|
608
605
|
}
|
|
@@ -610,7 +607,7 @@ class PeerSet {
|
|
|
610
607
|
return this.#addOrUpdatePeer(address, operationalServerAddress, discoveryData);
|
|
611
608
|
}
|
|
612
609
|
#getLastOperationalAddress(address) {
|
|
613
|
-
return this
|
|
610
|
+
return this.get(address)?.descriptor.operationalAddress;
|
|
614
611
|
}
|
|
615
612
|
#handleFirstRetry(session) {
|
|
616
613
|
if (!session.isSecure || session.fabric === void 0) {
|
|
@@ -621,15 +618,16 @@ class PeerSet {
|
|
|
621
618
|
return;
|
|
622
619
|
}
|
|
623
620
|
const address = fabric.addressOf(nodeId);
|
|
624
|
-
|
|
621
|
+
const peer = this.for(address);
|
|
622
|
+
if (peer.activeDiscovery) {
|
|
625
623
|
return;
|
|
626
624
|
}
|
|
627
|
-
|
|
625
|
+
peer.activeDiscovery = { type: 1 /* RetransmissionDiscovery */ };
|
|
628
626
|
this.#scanners.scannerFor(ChannelType.UDP)?.findOperationalDevice(fabric, nodeId, RETRANSMISSION_DISCOVERY_TIMEOUT, true).catch((error) => {
|
|
629
627
|
logger.error(`Failed to discover ${address} after resubmission started.`, error);
|
|
630
628
|
}).finally(() => {
|
|
631
|
-
if (
|
|
632
|
-
|
|
629
|
+
if (peer.activeDiscovery?.type === 1 /* RetransmissionDiscovery */) {
|
|
630
|
+
peer.activeDiscovery = void 0;
|
|
633
631
|
}
|
|
634
632
|
});
|
|
635
633
|
}
|