Skip to content

Commit

Permalink
Merge pull request #47 from ClickHouse/backport_artpaul_pr_112
Browse files Browse the repository at this point in the history
  • Loading branch information
traceon committed Aug 15, 2020
2 parents 41dd02a + 4f8e8bf commit 69470d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions clickhouse/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Client::Impl::Impl(const ClientOptions& opts)
{
// TODO: throw on big-endianness of platform

for (int i = 0; ; ) {
for (unsigned int i = 0; ; ) {
try {
ResetConnection();
break;
Expand Down Expand Up @@ -731,7 +731,7 @@ bool Client::Impl::ReceiveHello() {
}

void Client::Impl::RetryGuard(std::function<void()> func) {
for (int i = 0; i <= options_.send_retries; ++i) {
for (unsigned int i = 0; ; ++i) {
try {
func();
return;
Expand All @@ -745,7 +745,7 @@ void Client::Impl::RetryGuard(std::function<void()> func) {
ok = false;
}

if (!ok) {
if (!ok && i == options_.send_retries) {
throw;
}
}
Expand Down
6 changes: 3 additions & 3 deletions clickhouse/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct ClientOptions {
/// Hostname of the server.
DECLARE_FIELD(host, std::string, SetHost, std::string());
/// Service port.
DECLARE_FIELD(port, int, SetPort, 9000);
DECLARE_FIELD(port, unsigned int, SetPort, 9000);

/// Default database.
DECLARE_FIELD(default_database, std::string, SetDefaultDatabase, "default");
Expand All @@ -57,7 +57,7 @@ struct ClientOptions {
/// Ping server every time before execute any query.
DECLARE_FIELD(ping_before_query, bool, SetPingBeforeQuery, false);
/// Count of retry to send request to server.
DECLARE_FIELD(send_retries, int, SetSendRetries, 1);
DECLARE_FIELD(send_retries, unsigned int, SetSendRetries, 1);
/// Amount of time to wait before next retry.
DECLARE_FIELD(retry_timeout, std::chrono::seconds, SetRetryTimeout, std::chrono::seconds(5));

Expand All @@ -68,7 +68,7 @@ struct ClientOptions {
DECLARE_FIELD(tcp_keepalive, bool, TcpKeepAlive, false);
DECLARE_FIELD(tcp_keepalive_idle, std::chrono::seconds, SetTcpKeepAliveIdle, std::chrono::seconds(60));
DECLARE_FIELD(tcp_keepalive_intvl, std::chrono::seconds, SetTcpKeepAliveInterval, std::chrono::seconds(5));
DECLARE_FIELD(tcp_keepalive_cnt, int, SetTcpKeepAliveCount, 3);
DECLARE_FIELD(tcp_keepalive_cnt, unsigned int, SetTcpKeepAliveCount, 3);

#undef DECLARE_FIELD
};
Expand Down

0 comments on commit 69470d1

Please # to comment.