Skip to content

Commit

Permalink
SDENT-185 (#552)
Browse files Browse the repository at this point in the history
* Fix for SDENT-185
  • Loading branch information
bisenpiyush authored Mar 27, 2020
1 parent 5d5401f commit b8c343c
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions native/src/snappyclient/cpp/impl/ControlConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const boost::optional<ControlConnection&> ControlConnection::getOrCreateControlC
}
}

if (allConnSize == 0) { // first attempt of creating connection
{ // first attempt of creating connection
// if we reached here, then need to create a new ControlConnection
std::unique_ptr<ControlConnection> controlConn(
new ControlConnection(service));
Expand All @@ -143,16 +143,8 @@ const boost::optional<ControlConnection&> ControlConnection::getOrCreateControlC
}
}
s_allConnections.push_back(std::move(controlConn));
return *s_allConnections.back();
} else {
thrift::SnappyException ex;
SnappyExceptionData snappyExData;
snappyExData.__set_sqlState(
std::string(SQLState::UNKNOWN_EXCEPTION.getSQLState()));
snappyExData.__set_reason("Failed to connect");
ex.__set_exceptionData(snappyExData);
throw ex;
}
return *s_allConnections.back();
}

void ControlConnection::getLocatorPreferredServer(
Expand Down Expand Up @@ -360,10 +352,7 @@ void ControlConnection::failoverToAvailableHost(
const thrift::SnappyException ControlConnection::unexpectedError(
const std::exception& ex, const thrift::HostAddress& host) {

if (m_controlLocator != nullptr) {
m_controlLocator->getOutputProtocol()->getTransport()->close();
m_controlLocator.reset(nullptr);
}
close(false);
thrift::SnappyException snappyEx;
SnappyExceptionData snappyExData;
snappyExData.__set_sqlState(
Expand Down

0 comments on commit b8c343c

Please sign in to comment.