mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Use more C++11 features:
* Remove beast::static_initializer * Remove noexcept VS2013 workaround * Use [[noreturn]] attribute
This commit is contained in:
@@ -19,18 +19,21 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/basics/contract.h>
|
||||
#include <cstdlib>
|
||||
#include <exception>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
namespace detail {
|
||||
|
||||
[[noreturn]]
|
||||
void
|
||||
accessViolation()
|
||||
accessViolation() noexcept
|
||||
{
|
||||
// dereference memory
|
||||
// location zero
|
||||
// dereference memory location zero
|
||||
int volatile* j = 0;
|
||||
(void)*j;
|
||||
std::abort ();
|
||||
}
|
||||
|
||||
// This hook lets you do pre or post
|
||||
@@ -43,8 +46,9 @@ throwException (std::exception_ptr ep)
|
||||
|
||||
} // detail
|
||||
|
||||
[[noreturn]]
|
||||
void
|
||||
LogicError (std::string const&)
|
||||
LogicError (std::string const&) noexcept
|
||||
{
|
||||
detail::accessViolation();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <ripple/basics/chrono.h>
|
||||
#include <beast/container/aged_unordered_set.h>
|
||||
#include <beast/module/core/diagnostic/FatalError.h>
|
||||
#include <beast/utility/static_initializer.h>
|
||||
#include <cstdint>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
@@ -323,9 +322,7 @@ disallowRenegotiation (SSL const* ssl, bool isNew)
|
||||
// Do not allow a connection to renegotiate
|
||||
// more than once every 4 minutes
|
||||
|
||||
static beast::static_initializer <StaticData> static_data;
|
||||
|
||||
auto& sd (static_data.get ());
|
||||
static StaticData sd;
|
||||
std::lock_guard <std::mutex> lock (sd.lock);
|
||||
auto const expired (sd.set.clock().now() - std::chrono::minutes(4));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user