Open arcusfelis opened 3 years ago
Alternatively, we can try both ipv6 and ipv4, like in this commit: https://github.com/arcusfelis/eredis/commit/96a3848af1d54cadb09700ef8b1014e92183587d
But I doubt the code compexity introduced in this case would justify that.
We already have some complex code with not expected behaviour with get_addr/1
.
Hi, sometimes we have Docker configured with ipv6 resolving, but Redis server is only listening on ipv4. So redis_client would resolve ipv6, try to connect and fail with a pretty non-descriptive
eaddrnotavail
. After that people would try to dotelnet localhost 6379
and it would work. They would try to dogen_tcp:connect("localhost", 6379, []).
and it would work. But eredis would not work.eredis would basically do that behind the scene:
I doubt this code is even needed:
It would be much cleaner solution to just use
gen_tcp:connect/3
logic and passState#state.host
as a first argument, without resolving it first. If people really need to use ipv6, they could pass inet6 inside of SocketOpts.