Skip to content

Commit

Permalink
GEODE-8553 Revision 4
Browse files Browse the repository at this point in the history
 - Fixed move semantics for ConnectionWrapper.
 - Changed signed types to unsigned types.
  • Loading branch information
gaussianrecurrence committed Oct 4, 2020
1 parent a44817b commit 66c5679
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
10 changes: 5 additions & 5 deletions cppcache/src/ThinClientLocatorHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ namespace apache {
namespace geode {
namespace client {

const int BUFF_SIZE = 3000;
const int DEFAULT_CONNECTION_RETRIES = 3;
const size_t BUFF_SIZE = 3000;
const size_t DEFAULT_CONNECTION_RETRIES = 3;

ThinClientLocatorHelper::ConnectionWrapper::~ConnectionWrapper() {
if (conn_ != nullptr) {
Expand All @@ -64,7 +64,7 @@ ThinClientLocatorHelper::ThinClientLocatorHelper(
m_sniProxyHost(sniProxyHost),
m_sniProxyPort(sniProxyPort) {}

int ThinClientLocatorHelper::getConnRetries() const {
size_t ThinClientLocatorHelper::getConnRetries() const {
auto retries = m_poolDM->getRetryAttempts();
return retries <= 0 ? DEFAULT_CONNECTION_RETRIES : retries;
}
Expand Down Expand Up @@ -202,7 +202,7 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewCallBackConn(
"%d ",
maxAttempts);

for (auto attempt = 0; attempt < maxAttempts;) {
for (auto attempt = 0ULL; attempt < maxAttempts;) {
const auto& loc = locators[attempt++ % locatorsSize];
LOGFINER("Querying locator at [%s:%d] for queue server from group [%s]",
loc.getServerName().c_str(), loc.getPort(), serverGrp.c_str());
Expand Down Expand Up @@ -235,7 +235,7 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewFwdConn(
"ThinClientLocatorHelper::getEndpointForNewFwdConn maxAttempts = %d ",
maxAttempts);

for (auto attempt = 0; attempt < maxAttempts;) {
for (auto attempt = 0ULL; attempt < maxAttempts;) {
const auto& loc = locators[attempt++ % locatorsSize];
LOGFINE("Querying locator at [%s:%d] for server from group [%s]",
loc.getServerName().c_str(), loc.getPort(), serverGrp.c_str());
Expand Down
10 changes: 6 additions & 4 deletions cppcache/src/ThinClientLocatorHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class ThinClientLocatorHelper {
GfErrType getAllServers(
std::vector<std::shared_ptr<ServerLocation> >& servers,
const std::string& serverGrp) const;
int32_t getCurLocatorsNum() const {
return static_cast<int32_t>(locators_.size());
size_t getCurLocatorsNum() const {
return locators_.size();
}
GfErrType updateLocators(const std::string& serverGrp = "");

Expand All @@ -84,7 +84,9 @@ class ThinClientLocatorHelper {

explicit ConnectionWrapper(Connector* conn) : conn_(conn) {}
ConnectionWrapper(ConnectionWrapper&& other)
: conn_(std::move(other.conn_)) {}
: conn_(other.conn_) {
other.conn_ = nullptr;
}

~ConnectionWrapper();

Expand All @@ -95,7 +97,7 @@ class ThinClientLocatorHelper {
* Returns the number of connections retries per request
* @return Number of connection retries towards locators
*/
int getConnRetries() const;
size_t getConnRetries() const;

/**
* Returns a shuffled copy of the current locators list
Expand Down

0 comments on commit 66c5679

Please sign in to comment.