@@ -51,8 +51,6 @@ using proto::BaseCommand;
51
51
52
52
static const uint32_t DefaultBufferSize = 64 * 1024 ;
53
53
54
- static const int KeepAliveIntervalInSeconds = 30 ;
55
-
56
54
static MessageId toMessageId (const proto::MessageIdData& messageIdData) {
57
55
return MessageIdBuilder::from (messageIdData).build ();
58
56
}
@@ -186,6 +184,7 @@ ClientConnection::ClientConnection(const std::string& logicalAddress, const std:
186
184
connectTimeoutTask_(
187
185
std::make_shared<PeriodicTask>(*executor_, clientConfiguration.getConnectionTimeout())),
188
186
outgoingBuffer_(SharedBuffer::allocate(DefaultBufferSize)),
187
+ keepAliveIntervalInSeconds_(clientConfiguration.getKeepAliveIntervalInSeconds()),
189
188
consumerStatsRequestTimer_(executor_->createDeadlineTimer ()),
190
189
maxPendingLookupRequest_(clientConfiguration.getConcurrentLookupRequest()),
191
190
clientVersion_(clientVersion),
@@ -310,7 +309,7 @@ void ClientConnection::handlePulsarConnected(const proto::CommandConnected& cmdC
310
309
// Only send keep-alive probes if the broker supports it
311
310
keepAliveTimer_ = executor_->createDeadlineTimer ();
312
311
if (keepAliveTimer_) {
313
- keepAliveTimer_->expires_from_now (std::chrono::seconds (KeepAliveIntervalInSeconds ));
312
+ keepAliveTimer_->expires_from_now (std::chrono::seconds (keepAliveIntervalInSeconds_ ));
314
313
auto weakSelf = weak_from_this ();
315
314
keepAliveTimer_->async_wait ([weakSelf](const ASIO_ERROR&) {
316
315
auto self = weakSelf.lock ();
@@ -1245,7 +1244,7 @@ void ClientConnection::handleKeepAliveTimeout() {
1245
1244
// be zero And we do not attempt to dereference the pointer.
1246
1245
Lock lock (mutex_);
1247
1246
if (keepAliveTimer_) {
1248
- keepAliveTimer_->expires_from_now (std::chrono::seconds (KeepAliveIntervalInSeconds ));
1247
+ keepAliveTimer_->expires_from_now (std::chrono::seconds (keepAliveIntervalInSeconds_ ));
1249
1248
auto weakSelf = weak_from_this ();
1250
1249
keepAliveTimer_->async_wait ([weakSelf](const ASIO_ERROR&) {
1251
1250
auto self = weakSelf.lock ();
0 commit comments