Skip to content

Add list of hosts with ports for setting connection #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Delete extra changes
  • Loading branch information
df530 committed Dec 13, 2021
commit 25b7fdce699001ad353069b171036b08b3e4b8f5
4 changes: 2 additions & 2 deletions clickhouse/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class Client::Impl {

};


const ClientOptions options_;
QueryEvents* events_;
int compression_ = CompressionState::Disable;
Expand Down Expand Up @@ -291,8 +292,7 @@ void Client::Impl::ResetConnection() {
for (size_t i = 0; i < options_.hosts_ports.size(); ++i) {
try {
const ClientOptions::HostPort& host_port = options_.hosts_ports[i];
NetworkAddress na = NetworkAddress(host_port.host, std::to_string(host_port.port.value_or(options_.port)));
SocketHolder s(SocketConnect(na));
SocketHolder s(SocketConnect(NetworkAddress(host_port.host, std::to_string(host_port.port.value_or(options_.port)))));

if (s.Closed()) {
throw std::system_error(errno, std::system_category());
Expand Down