fix: ignore mdns REMOVED package (#1296)
Some checks failed
Tests / check-rule-format (push) Failing after 0s
Validate / validate-hassfest (push) Failing after -1s
Validate / validate-hacs (push) Failing after 6s
Validate / validate-lint (push) Failing after -2s
Validate / validate-setup (push) Failing after 0s

This commit is contained in:
Li Shuzhen
2025-11-17 11:15:10 +08:00
committed by GitHub
parent f95c71c2ad
commit 33ee65cf75
2 changed files with 9 additions and 8 deletions

View File

@@ -1048,11 +1048,11 @@ class MIoTClient:
mips = self._mips_local.get(group_id, None) mips = self._mips_local.get(group_id, None)
if mips: if mips:
if state == MipsServiceState.REMOVED: # if state == MipsServiceState.REMOVED:
mips.disconnect() # mips.disconnect()
self._mips_local.pop(group_id, None) # self._mips_local.pop(group_id, None)
return # return
if ( if ( # ADDED or UPDATED
mips.client_id == self._entry_data['virtual_did'] mips.client_id == self._entry_data['virtual_did']
and mips.host == data['addresses'][0] and mips.host == data['addresses'][0]
and mips.port == data['port'] and mips.port == data['port']

View File

@@ -232,9 +232,10 @@ class MipsService:
for item in list(self._services.values()): for item in list(self._services.values()):
if item['name'] != name: if item['name'] != name:
continue continue
service_data = self._services.pop(item['group_id'], {}) # Ignore mdns REMOVED package. Let the connection close by itself.
self.__call_service_change( # service_data = self._services.pop(item['group_id'], {})
state=MipsServiceState.REMOVED, data=service_data) # self.__call_service_change(
# state=MipsServiceState.REMOVED, data=service_data)
return return
self._main_loop.create_task( self._main_loop.create_task(
self.__request_service_info_async(zeroconf, service_type, name)) self.__request_service_info_async(zeroconf, service_type, name))