mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Add safe_cast (RIPD-1702):
This change ensures that no overflow can occur when casting between enums and integral types.
This commit is contained in:
committed by
Nik Bougalis
parent
494724578a
commit
148bbf4e8f
@@ -864,12 +864,11 @@ ServerHandlerImp::processRequest (Port const& port,
|
||||
}
|
||||
auto response = to_string (reply);
|
||||
|
||||
rpc_time_.notify (static_cast <beast::insight::Event::value_type> (
|
||||
rpc_time_.notify (
|
||||
std::chrono::duration_cast <std::chrono::milliseconds> (
|
||||
std::chrono::high_resolution_clock::now () - start)));
|
||||
std::chrono::high_resolution_clock::now () - start));
|
||||
++rpc_requests_;
|
||||
rpc_size_.notify (static_cast <beast::insight::Event::value_type> (
|
||||
response.size ()));
|
||||
rpc_size_.notify (beast::insight::Event::value_type{response.size()});
|
||||
|
||||
response += '\n';
|
||||
|
||||
|
||||
@@ -187,8 +187,8 @@ ShardArchiveHandler::complete(path dstPath)
|
||||
auto const mode {ptr->app_.getOPs().getOperatingMode()};
|
||||
if (ptr->validate_ && mode != NetworkOPs::omFULL)
|
||||
{
|
||||
timer_.expires_from_now(static_cast<std::chrono::seconds>(
|
||||
(NetworkOPs::omFULL - mode) * 10));
|
||||
timer_.expires_from_now(std::chrono::seconds{
|
||||
(NetworkOPs::omFULL - mode) * 10});
|
||||
timer_.async_wait(
|
||||
[=, dstPath = std::move(dstPath), ptr = std::move(ptr)]
|
||||
(boost::system::error_code const& ec)
|
||||
|
||||
Reference in New Issue
Block a user