void KaaChannelManager::onServerFailed(ITransportConnectionInfoPtr connectionInfo) { if (isShutdown_) { KAA_LOG_WARN("Can't update server. Channel manager is down"); return; } if (!connectionInfo) { KAA_LOG_WARN("Failed to process server failure: bad input data") throw KaaException("empty connection info pointer"); } if (connectionInfo->isFailedState()) { KAA_LOG_DEBUG("Connection already failed. Ignoring connection failover!"); return; } else { connectionInfo->setFailedState(); } if (connectionInfo->getServerType() == ServerType::BOOTSTRAP) { ITransportConnectionInfoPtr nextConnectionInfo = getNextBootstrapServer(connectionInfo->getTransportId(), false); if (nextConnectionInfo) { onTransportConnectionInfoUpdated(nextConnectionInfo); } else { FailoverStrategyDecision decision = failoverStrategy_->onFailover(Failover::BOOTSTRAP_SERVERS_NA); switch (decision.getAction()) { case FailoverStrategyAction::NOOP: KAA_LOG_WARN("No operation is performed according to failover strategy decision."); break; case FailoverStrategyAction::RETRY: { std::size_t period = decision.getRetryPeriod(); KAA_LOG_WARN(boost::format("Attempt to reconnect to first bootstrap server will be made in %1% secs " "according to failover strategy decision.") % period); bsTransportId_ = connectionInfo->getTransportId(); retryTimer_.stop(); retryTimer_.start(period, [&] { onTransportConnectionInfoUpdated(getNextBootstrapServer(bsTransportId_, true)); }); break; } case FailoverStrategyAction::STOP_APP: KAA_LOG_WARN("Stopping application according to failover strategy decision!"); exit(EXIT_FAILURE); break; default: break; } } } else { bootstrapManager_.useNextOperationsServer(connectionInfo->getTransportId()); } }