fpco/streaming-commons — pull request #6 by anton-dessiatov (2014-05-21 09:45:21+00:00)
Title: AddrFamily support for ClientSettings

Currently there is a problem in network-streaming-commons and all dependent packages that it is not possible to choose an explicit address family for the hostname and port.

When I specify "localhost" as the host name, it gets resolved to both "127.0.0.1" (IPv4) or "::1" (IPv6). An exact order of the resolved addresses is OS-dependent and at least for Windows Server 2008, an IPv6 address is the first one. This creates a hard-to-debug issues when incorrect version of IP gets used to connect to a server.

Proposed patch offers a bit of control over getAddrInfo behavior allowing user to specify desired address family explicitly. It changes public interface of the library by adding two functions: getAddrFamily and setAddrFamily.

I'm not sure whether it's okay to export these functions without re-exporting their argument types (NS.Family). Anyone who is going to use them will have to import Network.Sockets as well, which isn't very convenient, but I've tried to keep my changes as minimal as possible.