Remove tick timer
External tick timers were never something we used, so they're
effectively dead code, even if they do still execute.
Remove them.
Tested:
Loaded bmcweb on a system, and pulled down webui-vue.
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: I65bbc24d59cfa45adeb013055a2eab2eeb26ad3d
diff --git a/http/app.h b/http/app.h
index b810374..2eca4d2 100644
--- a/http/app.h
+++ b/http/app.h
@@ -27,8 +27,6 @@
class App
{
public:
- using self_t = App;
-
#ifdef BMCWEB_ENABLE_SSL
using ssl_socket_t = boost::beast::ssl_stream<boost::asio::ip::tcp::socket>;
using ssl_server_t = Server<App, ssl_socket_t>;
@@ -68,19 +66,19 @@
return router.newRuleTagged<Tag>(std::move(rule));
}
- self_t& socket(int existing_socket)
+ App& socket(int existing_socket)
{
socketFd = existing_socket;
return *this;
}
- self_t& port(std::uint16_t port)
+ App& port(std::uint16_t port)
{
portUint = port;
return *this;
}
- self_t& bindaddr(std::string bindaddr)
+ App& bindaddr(std::string bindaddr)
{
bindaddrStr = bindaddr;
return *this;
@@ -105,7 +103,6 @@
sslServer =
std::make_unique<ssl_server_t>(this, socketFd, sslContext, io);
}
- sslServer->setTickFunction(tickInterval, tickFunction);
sslServer->run();
#else
@@ -120,7 +117,6 @@
server = std::move(
std::make_unique<server_t>(this, socketFd, nullptr, io));
}
- server->setTickFunction(tickInterval, tickFunction);
server->run();
#endif
@@ -148,8 +144,8 @@
}
#ifdef BMCWEB_ENABLE_SSL
- self_t& sslFile(const std::string& crt_filename,
- const std::string& key_filename)
+ App& sslFile(const std::string& crt_filename,
+ const std::string& key_filename)
{
sslContext = std::make_shared<ssl_context_t>(
boost::asio::ssl::context::tls_server);
@@ -164,7 +160,7 @@
return *this;
}
- self_t& sslFile(const std::string& pem_filename)
+ App& sslFile(const std::string& pem_filename)
{
sslContext = std::make_shared<ssl_context_t>(
boost::asio::ssl::context::tls_server);
@@ -178,7 +174,7 @@
return *this;
}
- self_t& ssl(std::shared_ptr<boost::asio::ssl::context>&& ctx)
+ App& ssl(std::shared_ptr<boost::asio::ssl::context>&& ctx)
{
sslContext = std::move(ctx);
BMCWEB_LOG_INFO << "app::ssl context use_count="
@@ -190,7 +186,7 @@
#else
template <typename T, typename... Remain>
- self_t& ssl_file(T&&, Remain&&...)
+ App& ssl_file(T&&, Remain&&...)
{
// We can't call .ssl() member function unless BMCWEB_ENABLE_SSL is
// defined.
@@ -202,7 +198,7 @@
}
template <typename T>
- self_t& ssl(T&&)
+ App& ssl(T&&)
{
// We can't call .ssl() member function unless BMCWEB_ENABLE_SSL is
// defined.
@@ -214,14 +210,6 @@
}
#endif
- template <typename Duration, typename Func>
- self_t& tick(Duration d, Func f)
- {
- tickInterval = std::chrono::duration_cast<std::chrono::milliseconds>(d);
- tickFunction = f;
- return *this;
- }
-
private:
std::shared_ptr<asio::io_context> io;
#ifdef BMCWEB_ENABLE_SSL
@@ -233,9 +221,6 @@
int socketFd = -1;
Router router;
- std::chrono::milliseconds tickInterval{};
- std::function<void()> tickFunction;
-
#ifdef BMCWEB_ENABLE_SSL
std::unique_ptr<ssl_server_t> sslServer;
#else
diff --git a/http/http_server.h b/http/http_server.h
index b5fd4da..422b3a7 100644
--- a/http/http_server.h
+++ b/http/http_server.h
@@ -37,8 +37,8 @@
std::make_shared<boost::asio::io_context>()) :
ioService(std::move(io)),
acceptor(std::move(acceptorIn)),
- signals(*ioService, SIGINT, SIGTERM, SIGHUP), tickTimer(*ioService),
- timer(*ioService), handler(handlerIn), adaptorCtx(adaptor_ctx)
+ signals(*ioService, SIGINT, SIGTERM, SIGHUP), timer(*ioService),
+ handler(handlerIn), adaptorCtx(adaptor_ctx)
{}
Server(Handler* handlerIn, const std::string& bindaddr, uint16_t port,
@@ -62,26 +62,6 @@
adaptor_ctx, io)
{}
- void setTickFunction(std::chrono::milliseconds d, std::function<void()> f)
- {
- tickInterval = d;
- tickFunction = f;
- }
-
- void onTick()
- {
- tickFunction();
- tickTimer.expires_after(
- std::chrono::milliseconds(tickInterval.count()));
- tickTimer.async_wait([this](const boost::system::error_code& ec) {
- if (ec)
- {
- return;
- }
- onTick();
- });
- }
-
void updateDateStr()
{
time_t lastTimeT = time(nullptr);
@@ -125,19 +105,6 @@
};
timer.async_wait(timerHandler);
- if (tickFunction && tickInterval.count() > 0)
- {
- tickTimer.expires_after(
- std::chrono::milliseconds(tickInterval.count()));
- tickTimer.async_wait([this](const boost::system::error_code& ec) {
- if (ec)
- {
- return;
- }
- onTick();
- });
- }
-
BMCWEB_LOG_INFO << serverName << " server is running, local endpoint "
<< acceptor->local_endpoint();
startAsyncWaitForSignal();
@@ -258,7 +225,6 @@
std::function<std::string()> getCachedDateStr;
std::unique_ptr<tcp::acceptor> acceptor;
boost::asio::signal_set signals;
- boost::asio::steady_timer tickTimer;
boost::asio::steady_timer timer;
std::string dateStr;
@@ -266,8 +232,6 @@
Handler* handler;
std::string serverName = "bmcweb";
- std::chrono::milliseconds tickInterval{};
- std::function<void()> tickFunction;
std::function<void(const boost::system::error_code& ec)> timerHandler;
#ifdef BMCWEB_ENABLE_SSL