buzz-me-in 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/homekit.js +12 -4
- package/package.json +1 -1
package/homekit.js
CHANGED
|
@@ -766,14 +766,22 @@ function setOnHapSessionStarted(handler) {
|
|
|
766
766
|
/**
|
|
767
767
|
* Graceful shutdown: tear down streaming sessions and unpublish the
|
|
768
768
|
* accessory so the mDNS advertisement does not linger after exit.
|
|
769
|
+
*
|
|
770
|
+
* MUST be unpublish(), never destroy(). Both tear down the HAP server and the
|
|
771
|
+
* mDNS advertiser, but destroy() additionally calls
|
|
772
|
+
* Accessory.cleanupAccessoryData(), which deletes AccessoryInfo,
|
|
773
|
+
* IdentifierCache and ControllerStorage from persist/ — i.e. it erases every
|
|
774
|
+
* HomeKit pairing. destroy() means "this accessory is gone for good"; a
|
|
775
|
+
* restart is not that. Using it here silently unpaired the accessory on every
|
|
776
|
+
* clean stop, restart and reboot.
|
|
769
777
|
*/
|
|
770
778
|
function shutdown() {
|
|
771
779
|
endHapSession();
|
|
772
780
|
removeSdpDir();
|
|
773
|
-
accessory.
|
|
774
|
-
logger.error('Failed to
|
|
775
|
-
event: 'accessory-
|
|
776
|
-
reason: '
|
|
781
|
+
accessory.unpublish().catch((error) => {
|
|
782
|
+
logger.error('Failed to unpublish HAP accessory during shutdown', {
|
|
783
|
+
event: 'accessory-unpublish-failed',
|
|
784
|
+
reason: 'unpublish-threw',
|
|
777
785
|
error,
|
|
778
786
|
});
|
|
779
787
|
});
|