Skip to content
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

Remove duplicate hosts from zeroconf list #43

Closed
GoogleCodeExporter opened this issue May 26, 2015 · 4 comments
Closed

Remove duplicate hosts from zeroconf list #43

GoogleCodeExporter opened this issue May 26, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

(Originally posted as a comment in issue 34, but I thought that might get
lost, since the issue is closed.)

When using zeroconf/avahi, hosts with multiple IP addresses (e.g. either
IPv4+IPv6 or wired+wireless) show up more than once.  The attached patch
filters the duplicates out by service name.

For example, on my machine:

$ avahi-browse -t _distcc._tcp
+ wlan IPv6 distcc@averatec
+ wlan IPv4 distcc@averatec
+ wired IPv6 distcc@averatec
+ wired IPv4 distcc@acerlin
+ wired IPv4 distcc@averatec

$ export DISTCC_HOSTS=+zeroconf

Without the patch, I get:

$ distcc --show-hosts
[fe80::221:85ff:fe7b:6468]:3632/8
192.168.1.114:3632/8
[fe80::221:85ff:fe4a:4151]:3632/8
192.168.2.17:3632/8
192.168.2.23:3632/4

After the patch, the 'distcc@averatec' entries are collapsed into one:

$ distcc --show-hosts
192.168.2.17:3632/8
192.168.2.23:3632/4

Patch is against svn@662.

-- Ben

Original issue reported on code.google.com by benizi on 8 Apr 2009 at 5:14

Attachments:

@GoogleCodeExporter
Copy link
Author

The code has a bug; it can access b->host after calling free_host(b).

Some more comments for the new function would help, e.g. explaining why.  (The 
bug
description is clear enough, but the code should have a similar explanation 
too. 
Future maintainers will be looking at the code, not at the bug description.)

Also, I would prefer more descriptive variable names, e.g. host1, host2, prev 
rather
than a, b, p.

Otherwise, this looks fine.

Original comment by fergus.h...@gmail.com on 8 Apr 2009 at 5:31

  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

*slaps forehead*.  Yep, missed that bug.

I took the hint for variable names from remove_service (which uses 'h' and 
'p'). 
Changed to host1, host2, and prev.

Original comment by benizi on 8 Apr 2009 at 6:29

Attachments:

@GoogleCodeExporter
Copy link
Author

Looks good to me now, thanks!

Do you want to go and and commit it?
I've made you a member of the "distcc" project, so you should have the right
permissions now.

(Please run "make check" first.)

Original comment by fergus.h...@gmail.com on 8 Apr 2009 at 6:54

@GoogleCodeExporter
Copy link
Author

Fixed in SVN revision 673.  Thanks!

Original comment by fergus.h...@gmail.com on 14 Apr 2009 at 8:33

  • Changed state: Fixed

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

No branches or pull requests

1 participant