sks-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sks-devel] [PATCH] IPv6 support


From: Yaron Minsky
Subject: Re: [Sks-devel] [PATCH] IPv6 support
Date: Sat, 7 Mar 2009 12:53:00 -0500

On Sat, Mar 7, 2009 at 2:53 AM, Phil Pennock <address@hidden> wrote:
On 2009-03-06 at 23:06 -0500, Yaron Minsky wrote:
>    - Cleaned up the way that IPv4 and IPv6 logic was chosen in the code so
>    as to reduce boilerplate

"let foo = bar in" in the middle of a list.  I have a lot to learn.  ;)

Yup.  Expressions are lurking everywhere....
 

>    - Got rid of incorrect use of ==.  In OCaml, == is physical equality,
>    whereas = is ordinary structural equality.

I discovered this at some point while writing the patch and thought I'd
cleaned things up; I think I left == only on things like character
tests, for which pervasives.mli documented == as identitcal to =.  I
guess it's better to just get in the habit of always using =, since they
are identical.

Exactly.  You should pretty much only use == when there's a reason, that is, specifically when the semantics are different.
 

>    - streamlined some repetitive code in membership.ml

I had somehow missed 'a option and Some; I just had an O'Caml-speaker
explain it to me.  *sigh*  I so wish I'd known about Some at the time.

Yeah, options are fantastic.  Much much cleaner and more explicit than sprinkling nulls around everywhere, which is what you need to do in most languages.
 

>    - other minor tweaks
>    - Defined the |! operator (used for creating function pipelines) and used
>    that to make the code more readable in a few spots.

Nice.

So, is there an easy way to detect from OCaml if there's a routable IPv6
service available, or should we provide knobs to disable IPv4 or IPv6?

In C, I'd use
 addrinfo_obj.ai_flags |= AI_ADDRCONFIG
for the getaddrinfo() call, so that addresses are only returned for
those address families for which such an address is configured on the
local system.  I couldn't see a way to do that in O'Caml.  I'm running
3.10.2 (FreeBSD port, ocaml-notk-3.10.2_1) and the socket handling in
unix.mli leaves somewhat to be desired, both in setsockopt for anything
other than socket-level options and flags for some of the newer
interfaces such as getaddrinfo().  :-/

This is the part I need to think about.  I actually know next to nothing about IPv6.  I really only looked at the code for very broad readability issues.

You should take a look at 3.11 and see if it fixes any of your issues.  That's what I"m currently compiling against.

If we really need to, we can write some C code to set the socket options and then wrap that up so we can call it from OCaml.

y
 

-Phil

_______________________________________________
Sks-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/sks-devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]