-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates to handle addition and removal of interfaces #12
Conversation
try: | ||
return e.args[0] | ||
except IndexError: | ||
return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appeared that the OSError, socket.error
exceptions had an explicit errno
attribute so I made this match that, and also be defensive since the previous assert
could be removed with python -O
.
zeroconf.py
Outdated
self.log_exception_warning() | ||
except Exception as e: # TODO stop catching all Exceptions | ||
if get_errno(e) == errno.ENETUNREACH: | ||
self.log_warning_once("Network unreachable on interface {}".format(interface)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A fix to log socket write errors as simple warnings, as observed when interface becomes disconnected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests pass, new test makes sense, new functionality is awesome!
Changes
assert
that should likely persist ifpython -O
is usedZeroconf.__init__
into its own method_add_interfaces
_add_interfaces
functions but in reverseZeroconf.update_interfaces
which triggers add or removal of interfaces compared with already attached interfaceserrno.ENETUNREACH
Zeroconf.send
to accept aninterface
on which filter the interfaces it sends the messages on, such that adding and removing interfaces can attempt to send add/remove messages when the interface is removedWARNING: Network unreachable on interface 10.8.0.21
Notes
update_service
events, I believe the following scenario is handled: