You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue I ran into is a common one in Docker: inet:getaddrs(Hostname, inet6) will resolve for host.docker.internal, but you can't connect without special networking setup. inet:getaddrs(Hostname, inet) will resolve too, and connect by default.
One easy way around this is to flip the check so we check inet:getaddrs(Hostname, inet)first and see if that's valid an resolves. If it is, use ipv4. Otherwise, try ipv6.
After all, ipv4 is far more widely supported anyway.
IMO we could just let gen_tcp:connect do the DNS lookup and accept the inet and inet6 options. We should fix the code that assumes a list of tuples. We can probabaly use functions from proplists instead of lists.
zuiderkwast
changed the title
Support passing in :inet6 to gen_tcp:connect
Support passing in inet6 to gen_tcp:connectDec 24, 2024
Hey there,
As far as I can tell, the
{socket_options, SocketOpts}
aregen_tcp:connect_option
:https://github.com/Nordix/eredis/blob/master/src/eredis_client.erl#L455
Note it's not a list of tuples – one of the options is a bare atom!
Namely,
inet:address_family()
:So, to setup
inet6
, one needs to be able to pass in{socket_options, [inet6]}
toeredis
.However, these lines assume a keyword list:
https://github.com/Nordix/eredis/blob/master/src/eredis_client.erl#L438-L442
So, we get an ArgumentError:
lists.erl:1510: :lists.ukeymerge_1/3
Happy to open a PR here. As I understand it, current behavior is just trying to merge in default ?SOCKET_OPTS to provided opts
The text was updated successfully, but these errors were encountered: