A zeroconf proof of concept

Matt Mackall mpm at selenic.com
Mon Jun 30 14:32:07 CDT 2008


On Mon, 2008-06-30 at 14:23 -0500, Augie Fackler wrote:
> On Jun 30, 2008, at 2:14 PM, Matt Mackall wrote:
> 
> >
> > On Mon, 2008-06-30 at 14:06 -0500, Augie Fackler wrote:
> >> On Jun 30, 2008, at 2:03 PM, Matt Mackall wrote:
> >>
> >>>
> >>> On Mon, 2008-06-30 at 13:53 -0500, Augie Fackler wrote:
> >>>> On Jun 30, 2008, at 10:52 AM, Matt Mackall wrote:
> >>>>
> >>>>> <snip instructions>
> >>>>>
> >>>>> Theoretically, this extension should work on Linux, Mac, and
> >>>>> Windows,
> >>>>> but I've only tried it on Linux. Enjoy.
> >>>>
> >>>> I've been poking it a bit on OS X, and it's failing on the line
> >>>> s.connect(('1.0.0.1', 0)) with an exception claiming "Can't assign
> >>>> requested address". I don't have more time to put into this now,
> >>>> but I
> >>>> may get a chance to look at this tonight.
> >>>
> >>> That's this code, which is admittedly a little odd:
> >>>
> >>>>> +        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
> >>>>> +        s.connect(('1.0.0.1', 0))
> >>>>> +        ip = s.getsockname()[0]
> >>>>> +        localip = socket.inet_aton(ip)
> >>>
> >>> What's needed is a way to find a meaningful IP address for the
> >>> machine.
> >>> There are various things that don't work great and this is one of
> >>> them.
> >>> The idea is to open a dummy socket to a dummy address and find  
> >>> the
> >>> outgoing interface. The above on Linux doesn't even send a packet.
> >>
> >> Yeah, figured that out. It works here if I specify a nonzero port
> >> number.
> >>
> >> One thing I've noticed is that you're registering as an http server.
> >
> > Seems only sensible: we are an http server.
> 
> Indeed, but maybe we should publish both (say) _http._tcp and _hg._tcp  
> records, and then hg paths could sanely show only the _hg._tcp records  

Perhaps.

> (maybe giving it the option to show http servers too)?

Then we'd have to name it oneconf?

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list