cbrand / micropython-mdns

MDNS implementation for MicroPython with Service Discovery
MIT License
53 stars 12 forks source link

Calling query_once() multiple times causes duplicates to accumulate #11

Closed mirko closed 1 year ago

mirko commented 1 year ago

I'm calling query_once() every n seconds in a loop and noticed, that over time the list grows, starting containing duplicates. This happens until, in my case on esp32, the process crashes, causing a reset.

cbrand commented 1 year ago

Thank you for the report.

I checked the corresponding source code and do have a follow up question:

  1. Did you before calling query_once run the "protocol, service" calling query? That seems to be the only way this can accumulate if I read the code correctly.
  2. The returned list in query_once returns duplicates. Currently in the background there is a dictionary which hashes the DNS responses coming from the wire and do only use port and target as the dictionary hash generation. So could you double check if the port changes in the DNS responses?
cbrand commented 1 year ago

Closing this as I did not hear anything back. If you still run into the issue feel free to comment and I reopen it.