Skip to content

Commit f22f757

Browse files
committed
Reduce changes
1 parent 15aaa63 commit f22f757

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

lib/HandlerBase.cc

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,23 +89,23 @@ void HandlerBase::grabCnx() {
8989
return;
9090
}
9191
auto self = shared_from_this();
92-
client->getConnection(topic(), connectionKeySuffix_)
93-
.addListener([this, self](Result result, const ClientConnectionPtr& cnx) {
94-
if (result == ResultOk) {
95-
LOG_DEBUG(getName() << "Connected to broker: " << cnx->cnxString());
96-
connectionOpened(cnx).addListener([this, self](Result result, bool) {
97-
// Do not use bool, only Result.
98-
reconnectionPending_ = false;
99-
if (isResultRetryable(result)) {
100-
scheduleReconnection();
101-
}
102-
});
103-
} else {
104-
connectionFailed(result);
92+
auto cnxFuture = client->getConnection(topic(), connectionKeySuffix_);
93+
cnxFuture.addListener([this, self](Result result, const ClientConnectionPtr& cnx) {
94+
if (result == ResultOk) {
95+
LOG_DEBUG(getName() << "Connected to broker: " << cnx->cnxString());
96+
connectionOpened(cnx).addListener([this, self](Result result, bool) {
97+
// Do not use bool, only Result.
10598
reconnectionPending_ = false;
106-
scheduleReconnection();
107-
}
108-
});
99+
if (isResultRetryable(result)) {
100+
scheduleReconnection();
101+
}
102+
});
103+
} else {
104+
connectionFailed(result);
105+
reconnectionPending_ = false;
106+
scheduleReconnection();
107+
}
108+
});
109109
}
110110

111111
void HandlerBase::handleDisconnection(Result result, const ClientConnectionPtr& cnx) {

0 commit comments

Comments
 (0)