⚡ Sangsakala Proxy 🏠 Home
Skip to content

IP addresses change does not trigger update in browser #235

Closed

Description

@PhilippSelenium

Steps to reproduce

  1. Use example code from README:
from zeroconf import ServiceBrowser, Zeroconf


class MyListener:

    def remove_service(self, zeroconf, type, name):
        print("Service %s removed" % (name,))

    def add_service(self, zeroconf, type, name):
        info = zeroconf.get_service_info(type, name)
        print("Service %s added, service info: %s" % (name, info))

    def update_service(self, zeroconf, type, name):
        info = zeroconf.get_service_info(type, name)
        print("Service %s updated, service info: %s" % (name, info))

zeroconf = Zeroconf()
listener = MyListener()
browser = ServiceBrowser(zeroconf, "_http._tcp.local.", listener)
try:
    input("Press enter to exit...\n\n")
finally:
    zeroconf.close()
  1. Change IP address
    exp: An update message is printed.
    act: Nothing is printed

Notes:

  1. I can see the packets sent in wireshark.
  2. It works with version 0.24.4

zeroconf version: 0.24.5
python version: 3.6.7

Activity

  1. jstasiak commented on Apr 3, 2020

    @jstasiak
    Collaborator

    I narrowed this down to #228, cc @mattsaxon, I'll try to see if there's something obvious that I can fix quickly.

  2. jstasiak commented on Apr 3, 2020

    @jstasiak
    Collaborator

    I think this is because ServiceBrowser.update_record() only triggers ServiceStateChange on PTR and TXT record updates: https://github.com/jstasiak/python-zeroconf/blob/a79015e7c4bdc843d97bd5c82ef8ed4eeae01a34/zeroconf/__init__.py#L1428

  3. mattsaxon commented on Apr 3, 2020

    @mattsaxon
    Collaborator

    It’s is sort of by design that it doesn’t change with a changed IP address. We do need to change it so it triggers on SRV update though so I do appreciate this is both a regression and needs fixing, but I’d rather forward fix it to trigger on the SRV change as you suggest.

  4. jstasiak commented on Apr 3, 2020

    @jstasiak
    Collaborator

    Just so I understand – is it by design in relation to any part of RFC 6762 or 6763?

  5. mattsaxon commented on Apr 3, 2020

    @mattsaxon
    Collaborator

    Sorry, no I meant that the code was never designed to deal with an IP address change. The older code just got ‘lucky’, presumably
    because a spurious txt update came through. We should explicitly recognise SRV changes though, so that is the right change to make.

  6. mattsaxon commented on Apr 3, 2020

    @mattsaxon
    Collaborator

    Assign this and the other regression to
    me and I’ll sort them out when I get a chance

  7. emontnemery commented on Apr 6, 2020

    @emontnemery
    Collaborator

    Since this is a regression from #228, can #228 be reverted until IP address change is handled correctly?

  8. mattsaxon commented on Apr 6, 2020

    @mattsaxon
    Collaborator

    I should have forward fix available by end of today

  9. mattsaxon commented on Apr 6, 2020

    @mattsaxon
    Collaborator

    There is a possibility that my fix here is a breaking change as UpdateService used to get called on service addition. I feel this is wrong and was a mistake.

  10. jstasiak commented on Apr 6, 2020

    @jstasiak
    Collaborator

    Yeah I noticed that too, I agree this seems wrong and I'd say let's fix this.

  11. jstasiak commented on Apr 26, 2020

    @jstasiak
    Collaborator

    Fix released in version 0.26.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions