refactor(Core/Misc): Use steady_timer instead of deadline_timer (#20940)

This commit is contained in:
Kitzunu 2024-12-19 18:00:03 +01:00 committed by GitHub
parent ea02be964b
commit 0bc70670d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 65 additions and 78 deletions

View file

@ -18,14 +18,14 @@
#ifndef NetworkThread_h__
#define NetworkThread_h__
#include "DeadlineTimer.h"
#include "Define.h"
#include "Errors.h"
#include "IoContext.h"
#include "Log.h"
#include "Socket.h"
#include <atomic>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/steady_timer.hpp>
#include <atomic>
#include <memory>
#include <mutex>
#include <set>
@ -179,7 +179,7 @@ protected:
{
LOG_DEBUG("misc", "Network Thread Starting");
_updateTimer.expires_from_now(boost::posix_time::milliseconds(1));
_updateTimer.expires_at(std::chrono::steady_clock::now());
_updateTimer.async_wait([this](boost::system::error_code const&) { Update(); });
_ioContext.run();
@ -193,7 +193,7 @@ protected:
if (_stopped)
return;
_updateTimer.expires_from_now(boost::posix_time::milliseconds(1));
_updateTimer.expires_at(std::chrono::steady_clock::now());
_updateTimer.async_wait([this](boost::system::error_code const&) { Update(); });
AddNewSockets();
@ -230,7 +230,7 @@ private:
Acore::Asio::IoContext _ioContext;
tcp::socket _acceptSocket;
Acore::Asio::DeadlineTimer _updateTimer;
boost::asio::steady_timer _updateTimer;
bool _proxyHeaderReadingEnabled;
};