scylladb / cpp-driver

Scylla C/C++ Driver
25 stars 25 forks source link

Choose correct local address for targeted IP family #85

Open SeverinLeonhardt opened 1 year ago

SeverinLeonhardt commented 1 year ago

To connect to the right shard the driver needs to specify the local port. This is only possible by also choosing an IP address family (v4 or v6).

The code uses IPv4 by default, unless the user configures a different listen address. This means in the default configuration the Scylla driver is unable to connect to IPv6 addresses with a rather surprising "address not available" error.

This commit addresses that surprising behavior by not hard coding a default listen address but instead choosing one based on the IP address family that is being connected to.

mykaul commented 5 months ago

I wonder if it compiles without IPv6 support enabled on the machine, but that should be rate. Otherwise, LGTM.