mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Merge branch 'feature-cleanup' of github.com:vinniefalco/rippled into develop
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -61,3 +61,5 @@ DerivedData
|
||||
.idea/
|
||||
*.hmap
|
||||
|
||||
# Intel Parallel Studio 2013 XE
|
||||
My Amplifier XE Results - RippleD
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Express 2012 for Windows Desktop
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RippleD", "RippleD.vcxproj", "{19465545-42EE-42FA-9CC8-F8975F8F1CC7}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "beast", "..\..\Subtrees\beast\Builds\VisualStudio2012\beast.vcxproj", "{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RippleD", "RippleD.vcxproj", "{B7F39ECD-473C-484D-BC34-31F8362506A5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@@ -13,20 +13,22 @@ Global
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{19465545-42EE-42FA-9CC8-F8975F8F1CC7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{19465545-42EE-42FA-9CC8-F8975F8F1CC7}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{19465545-42EE-42FA-9CC8-F8975F8F1CC7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{19465545-42EE-42FA-9CC8-F8975F8F1CC7}.Debug|x64.Build.0 = Debug|x64
|
||||
{19465545-42EE-42FA-9CC8-F8975F8F1CC7}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{19465545-42EE-42FA-9CC8-F8975F8F1CC7}.Release|Win32.Build.0 = Release|Win32
|
||||
{19465545-42EE-42FA-9CC8-F8975F8F1CC7}.Release|x64.ActiveCfg = Release|x64
|
||||
{19465545-42EE-42FA-9CC8-F8975F8F1CC7}.Release|x64.Build.0 = Release|x64
|
||||
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|x64.Build.0 = Debug|x64
|
||||
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Release|Win32.Build.0 = Release|Win32
|
||||
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Release|x64.ActiveCfg = Release|x64
|
||||
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Release|x64.Build.0 = Release|x64
|
||||
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|x64.Build.0 = Debug|x64
|
||||
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|Win32.Build.0 = Release|Win32
|
||||
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|x64.ActiveCfg = Release|x64
|
||||
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_VARIADIC_MAX=10;_WIN32_WINNT=0x0600;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_VARIADIC_MAX=10;_WIN32_WINNT=0x0600;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>$(RepoDir);$(RepoDir)\src\cpp\protobuf\src;$(RepoDir)\src\cpp\protobuf\vsprojects;$(RepoDir)\build\proto;$(RepoDir)\Subtrees;$(RepoDir)\Subtrees\leveldb;$(RepoDir)\Subtrees\leveldb\include;$(RepoDir)\Subtrees\beast;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,34 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<RepoDir>.</RepoDir>
|
||||
<SrcDir>$(RepoDir)\src\cpp\ripple</SrcDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OutDir>$(SolutionDir)build\VisualStudio2012\$(Configuration).$(Platform)\</OutDir>
|
||||
<IntDir>$(SolutionDir)build\obj\VisualStudio2012\$(Configuration).$(Platform)\</IntDir>
|
||||
<TargetName>rippled</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>USE_LEVELDB;BOOST_TEST_ALTERNATIVE_INIT_API;BOOST_TEST_NO_MAIN;_WIN32_WINNT=0x0600;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>$(RepoDir);$(RepoDir)\src\cpp\leveldb;$(RepoDir)\src\cpp\leveldb\include;$(RepoDir)\src\cpp\protobuf\src;$(RepoDir)\src\cpp\protobuf\vsprojects;$(RepoDir)\build\proto;$(RepoDir)\Subtrees\beast;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<ExceptionHandling>Async</ExceptionHandling>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<BuildMacro Include="RepoDir">
|
||||
<Value>$(RepoDir)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="SrcDir">
|
||||
<Value>$(SrcDir)</Value>
|
||||
</BuildMacro>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -131,7 +131,11 @@ COMPILED_FILES = [
|
||||
'modules/ripple_app/ripple_app_pt1.cpp',
|
||||
'modules/ripple_app/ripple_app_pt2.cpp',
|
||||
'modules/ripple_app/ripple_app_pt3.cpp',
|
||||
'modules/ripple_app/ripple_app_pt4.cpp'
|
||||
'modules/ripple_app/ripple_app_pt4.cpp',
|
||||
'modules/ripple_app/ripple_app_pt5.cpp',
|
||||
'modules/ripple_app/ripple_app_pt6.cpp',
|
||||
'modules/ripple_app/ripple_app_pt7.cpp',
|
||||
'modules/ripple_app/ripple_app_pt8.cpp'
|
||||
]
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
@@ -723,6 +723,7 @@ public:
|
||||
|
||||
if (isPositiveAndBelow (indexToRemove, numUsed))
|
||||
{
|
||||
bassert (data.elements != nullptr);
|
||||
ElementType removed (data.elements[indexToRemove]);
|
||||
removeInternal (indexToRemove);
|
||||
return removed;
|
||||
|
||||
@@ -24,11 +24,6 @@
|
||||
#ifndef BEAST_OWNEDARRAY_BEASTHEADER
|
||||
#define BEAST_OWNEDARRAY_BEASTHEADER
|
||||
|
||||
#include "beast_ArrayAllocationBase.h"
|
||||
#include "beast_ElementComparator.h"
|
||||
#include "../threads/beast_CriticalSection.h"
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/** An array designed for holding objects.
|
||||
|
||||
@@ -51,7 +46,9 @@
|
||||
template <class ObjectClass,
|
||||
class TypeOfCriticalSectionToUse = DummyCriticalSection>
|
||||
|
||||
class OwnedArray : LeakChecked <OwnedArray <ObjectClass, TypeOfCriticalSectionToUse> >, Uncopyable
|
||||
class OwnedArray
|
||||
: LeakChecked <OwnedArray <ObjectClass, TypeOfCriticalSectionToUse> >
|
||||
, Uncopyable
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
@@ -242,23 +239,15 @@ public:
|
||||
as this will obviously cause deletion of dangling pointers.
|
||||
|
||||
@param newObject the new object to add to the array
|
||||
@returns the object that was added
|
||||
|
||||
@see set, insert, addIfNotAlreadyThere, addSorted
|
||||
*/
|
||||
ObjectClass const& add (ObjectClass const* const newObject) noexcept
|
||||
ObjectClass* add (ObjectClass* const newObject) noexcept
|
||||
{
|
||||
const ScopedLockType lock (getLock());
|
||||
data.ensureAllocatedSize (numUsed + 1);
|
||||
bassert (data.elements != nullptr);
|
||||
data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
|
||||
return *newObject;
|
||||
}
|
||||
|
||||
ObjectClass& add (ObjectClass* const newObject) noexcept
|
||||
{
|
||||
add (const_cast <ObjectClass const*> (newObject));
|
||||
return *newObject;
|
||||
return const_cast <ObjectClass*> (newObject);
|
||||
}
|
||||
|
||||
/** Inserts a new object into the array at the given index.
|
||||
@@ -276,12 +265,10 @@ public:
|
||||
|
||||
@param indexToInsertAt the index at which the new element should be inserted
|
||||
@param newObject the new object to add to the array
|
||||
@returns the object that was added
|
||||
|
||||
@see add, addSorted, addIfNotAlreadyThere, set
|
||||
*/
|
||||
ObjectClass const& insert (int indexToInsertAt,
|
||||
ObjectClass const* const newObject) noexcept
|
||||
void insert (int indexToInsertAt,
|
||||
ObjectClass* const newObject) noexcept
|
||||
{
|
||||
if (indexToInsertAt >= 0)
|
||||
{
|
||||
@@ -306,15 +293,6 @@ public:
|
||||
{
|
||||
add (newObject);
|
||||
}
|
||||
|
||||
return *newObject;
|
||||
}
|
||||
|
||||
ObjectClass& insert (int indexToInsertAt,
|
||||
ObjectClass* const newObject) noexcept
|
||||
{
|
||||
insert (indexToInsertAt, const_cast <ObjectClass const*> (newObject));
|
||||
return *newObject;
|
||||
}
|
||||
|
||||
/** Inserts an array of values into this array at a given position.
|
||||
@@ -363,22 +341,13 @@ public:
|
||||
If the array already contains a matching object, nothing will be done.
|
||||
|
||||
@param newObject the new object to add to the array
|
||||
@returns the object
|
||||
*/
|
||||
ObjectClass const& addIfNotAlreadyThere (ObjectClass const* const newObject) noexcept
|
||||
void addIfNotAlreadyThere (ObjectClass* const newObject) noexcept
|
||||
{
|
||||
const ScopedLockType lock (getLock());
|
||||
|
||||
if (! contains (newObject))
|
||||
add (newObject);
|
||||
|
||||
return *newObject;
|
||||
}
|
||||
|
||||
ObjectClass& addIfNotAlreadyThere (ObjectClass* const newObject) noexcept
|
||||
{
|
||||
addIfNotAlreadyThere (const_cast <ObjectClass const*> (newObject));
|
||||
return *newObject;
|
||||
}
|
||||
|
||||
/** Replaces an object in the array with a different one.
|
||||
@@ -392,13 +361,11 @@ public:
|
||||
@param indexToChange the index whose value you want to change
|
||||
@param newObject the new value to set for this index.
|
||||
@param deleteOldElement whether to delete the object that's being replaced with the new one
|
||||
@returns the object that was set
|
||||
|
||||
@see add, insert, remove
|
||||
*/
|
||||
ObjectClass const& set (int const indexToChange,
|
||||
ObjectClass const* const newObject,
|
||||
bool const deleteOldElement = true)
|
||||
void set (const int indexToChange,
|
||||
const ObjectClass* const newObject,
|
||||
const bool deleteOldElement = true)
|
||||
{
|
||||
if (indexToChange >= 0)
|
||||
{
|
||||
@@ -435,16 +402,6 @@ public:
|
||||
bassertfalse; // you're trying to set an object at a negative index, which doesn't have
|
||||
// any effect - but since the object is not being added, it may be leaking..
|
||||
}
|
||||
|
||||
return *newObject;
|
||||
}
|
||||
|
||||
ObjectClass& set (int const indexToChange,
|
||||
ObjectClass* const newObject,
|
||||
bool const deleteOldElement = true)
|
||||
{
|
||||
set (indexToChange, const_cast <ObjectClass const*> (newObject), deleteOldElement);
|
||||
return *newObject;
|
||||
}
|
||||
|
||||
/** Adds elements from another array to the end of this array.
|
||||
@@ -515,7 +472,7 @@ public:
|
||||
numElementsToAdd = arrayToAddFrom.size() - startIndex;
|
||||
|
||||
data.ensureAllocatedSize (numUsed + numElementsToAdd);
|
||||
bassert (numElementsToAdd <= 0 || data.elements != nullptr);
|
||||
bassert (numElementsToAdd <= 0 || data.elements != nullptr);
|
||||
|
||||
while (--numElementsToAdd >= 0)
|
||||
{
|
||||
@@ -909,4 +866,5 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
#endif // BEAST_OWNEDARRAY_BEASTHEADER
|
||||
|
||||
#endif
|
||||
|
||||
@@ -288,7 +288,7 @@ public:
|
||||
@param newObject the new object to add to the array
|
||||
@see set, insert, addIfNotAlreadyThere, addSorted, addArray
|
||||
*/
|
||||
void add (ObjectClass* const newObject) noexcept
|
||||
ObjectClass* add (ObjectClass* const newObject) noexcept
|
||||
{
|
||||
const ScopedLockType lock (getLock());
|
||||
data.ensureAllocatedSize (numUsed + 1);
|
||||
@@ -297,6 +297,8 @@ public:
|
||||
|
||||
if (newObject != nullptr)
|
||||
newObject->incReferenceCount();
|
||||
|
||||
return newObject;
|
||||
}
|
||||
|
||||
/** Inserts a new object into the array at the given index.
|
||||
@@ -312,8 +314,8 @@ public:
|
||||
@param newObject the new object to add to the array
|
||||
@see add, addSorted, addIfNotAlreadyThere, set
|
||||
*/
|
||||
void insert (int indexToInsertAt,
|
||||
ObjectClass* const newObject) noexcept
|
||||
ObjectClass* insert (int indexToInsertAt,
|
||||
ObjectClass* const newObject) noexcept
|
||||
{
|
||||
if (indexToInsertAt >= 0)
|
||||
{
|
||||
@@ -337,10 +339,12 @@ public:
|
||||
newObject->incReferenceCount();
|
||||
|
||||
++numUsed;
|
||||
|
||||
return newObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
add (newObject);
|
||||
return add (newObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -847,11 +851,11 @@ public:
|
||||
/** Returns the type of scoped lock to use for locking this array */
|
||||
typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType;
|
||||
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
|
||||
int numUsed;
|
||||
};
|
||||
|
||||
#endif // BEAST_REFERENCECOUNTEDARRAY_BEASTHEADER
|
||||
|
||||
#endif
|
||||
@@ -199,7 +199,7 @@ void findMinAndMax (const Type* values, int numValues, Type& lowest, Type& highe
|
||||
@param valueToConstrain the value to try to return
|
||||
@returns the closest value to valueToConstrain which lies between lowerLimit
|
||||
and upperLimit (inclusive)
|
||||
@see jlimit0To, bmin, bmax
|
||||
@see blimit0To, bmin, bmax
|
||||
*/
|
||||
template <typename Type>
|
||||
inline Type blimit (const Type lowerLimit,
|
||||
|
||||
@@ -148,10 +148,14 @@ public:
|
||||
volatile Type value;
|
||||
|
||||
private:
|
||||
static inline Type castFrom32Bit (int32 value) noexcept { return *(Type*) &value; }
|
||||
static inline Type castFrom64Bit (int64 value) noexcept { return *(Type*) &value; }
|
||||
static inline int32 castTo32Bit (Type value) noexcept { return *(int32*) &value; }
|
||||
static inline int64 castTo64Bit (Type value) noexcept { return *(int64*) &value; }
|
||||
template <typename Dest, typename Source>
|
||||
static inline Dest castTo (Source value) noexcept { union { Dest d; Source s; } u; u.s = value; return u.d; }
|
||||
|
||||
static inline Type castFrom32Bit (int32 value) noexcept { return castTo <Type, int32> (value); }
|
||||
static inline Type castFrom64Bit (int64 value) noexcept { return castTo <Type, int64> (value); }
|
||||
static inline int32 castTo32Bit (Type value) noexcept { return castTo <int32, Type> (value); }
|
||||
static inline int64 castTo64Bit (Type value) noexcept { return castTo <int64, Type> (value); }
|
||||
|
||||
|
||||
Type operator++ (int); // better to just use pre-increment with atomics..
|
||||
Type operator-- (int);
|
||||
|
||||
@@ -59,7 +59,13 @@ public:
|
||||
|
||||
/** The singleton is created on first use and persists until program exit.
|
||||
*/
|
||||
persistAfterCreation
|
||||
persistAfterCreation,
|
||||
|
||||
/** The singleton is created when needed and never destroyed.
|
||||
|
||||
This is useful for applications which do not have a clean exit.
|
||||
*/
|
||||
neverDestroyed
|
||||
};
|
||||
};
|
||||
|
||||
@@ -82,7 +88,8 @@ protected:
|
||||
{
|
||||
bassert (s_instance == nullptr);
|
||||
|
||||
if (m_lifetime == persistAfterCreation)
|
||||
if (m_lifetime == persistAfterCreation ||
|
||||
m_lifetime == neverDestroyed)
|
||||
{
|
||||
incReferenceCount ();
|
||||
}
|
||||
@@ -155,6 +162,9 @@ private:
|
||||
{
|
||||
bool destroy;
|
||||
|
||||
// Handle the condition where one thread is releasing the last
|
||||
// reference just as another thread is trying to acquire it.
|
||||
//
|
||||
{
|
||||
LockType::ScopedLockType lock (*s_mutex);
|
||||
|
||||
@@ -171,6 +181,8 @@ private:
|
||||
|
||||
if (destroy)
|
||||
{
|
||||
bassert (m_lifetime != neverDestroyed);
|
||||
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
|
||||
enum
|
||||
{
|
||||
U_ISOFS_SUPER_MAGIC = 0x9660, // linux/iso_fs.h
|
||||
U_MSDOS_SUPER_MAGIC = 0x4d44, // linux/msdos_fs.h
|
||||
U_NFS_SUPER_MAGIC = 0x6969, // linux/nfs_fs.h
|
||||
U_SMB_SUPER_MAGIC = 0x517B // linux/smb_fs.h
|
||||
U_ISOFS_SUPER_MAGIC = 5,
|
||||
U_MSDOS_SUPER_MAGIC = 2,
|
||||
U_NFS_SUPER_MAGIC = 1,
|
||||
U_SMB_SUPER_MAGIC = 8
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
@@ -94,7 +94,7 @@ bool File::isOnHardDisk() const
|
||||
|
||||
bool File::isOnRemovableDrive() const
|
||||
{
|
||||
bassertfalse; // xxx not implemented for linux!
|
||||
bassertfalse; // XXX not implemented for FreeBSD!
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -336,8 +336,8 @@ bool Process::openDocument (const String& fileName, const String& parameters)
|
||||
|| ! isFileExecutable (fileName))
|
||||
{
|
||||
// create a command that tries to launch a bunch of likely browsers
|
||||
const char* const browserNames[] = { "xdg-open", "/etc/alternatives/x-www-browser", "firefox", "mozilla",
|
||||
"google-chrome", "chromium-browser", "opera", "konqueror" };
|
||||
const char* const browserNames[] = { "xdg-open", "firefox", "seamonkey",
|
||||
"chrome", "opera", "konqueror" };
|
||||
StringArray cmdLines;
|
||||
|
||||
for (int i = 0; i < numElementsInArray (browserNames); ++i)
|
||||
|
||||
@@ -54,20 +54,9 @@ void Process::terminate()
|
||||
|
||||
BEAST_API bool BEAST_CALLTYPE beast_isRunningUnderDebugger()
|
||||
{
|
||||
static char testResult = 0;
|
||||
|
||||
if (testResult == 0)
|
||||
{
|
||||
testResult = (char) ptrace (PT_TRACE_ME, 0, 0, 0);
|
||||
|
||||
if (testResult >= 0)
|
||||
{
|
||||
ptrace (PT_DETACH, 0, (caddr_t) 1, 0);
|
||||
testResult = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return testResult < 0;
|
||||
// XXX not implemented for FreeBSD!
|
||||
bassertfalse;
|
||||
return false;
|
||||
}
|
||||
|
||||
BEAST_API bool BEAST_CALLTYPE Process::isRunningUnderDebugger()
|
||||
|
||||
@@ -78,7 +78,7 @@ int SystemStats::getMemorySizeInMegabytes()
|
||||
struct sysinfo sysi;
|
||||
|
||||
if (sysinfo (&sysi) == 0)
|
||||
return (sysi.totalram * sysi.mem_unit / (1024 * 1024));
|
||||
return sysi.totalram * sysi.mem_unit / (1024 * 1024);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -94,11 +94,8 @@ String SystemStats::getLogonName()
|
||||
const char* user = getenv ("USER");
|
||||
|
||||
if (user == nullptr)
|
||||
{
|
||||
struct passwd* const pw = getpwuid (getuid());
|
||||
if (pw != nullptr)
|
||||
if (passwd* const pw = getpwuid (getuid()))
|
||||
user = pw->pw_name;
|
||||
}
|
||||
|
||||
return CharPointer_UTF8 (user);
|
||||
}
|
||||
@@ -117,11 +114,12 @@ String SystemStats::getComputerName()
|
||||
return String::empty;
|
||||
}
|
||||
|
||||
String getLocaleValue (nl_item key)
|
||||
static String getLocaleValue (nl_item key)
|
||||
{
|
||||
const char* oldLocale = ::setlocale (LC_ALL, "");
|
||||
return String (const_cast <const char*> (nl_langinfo (key)));
|
||||
String result (String::fromUTF8 (nl_langinfo (key)));
|
||||
::setlocale (LC_ALL, oldLocale);
|
||||
return result;
|
||||
}
|
||||
|
||||
String SystemStats::getUserLanguage() { return getLocaleValue (_NL_IDENTIFICATION_LANGUAGE); }
|
||||
@@ -141,7 +139,7 @@ SystemStats::CPUFlags::CPUFlags()
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
uint32 beast_millisecondsSinceStartup() noexcept
|
||||
uint32 BEAST_millisecondsSinceStartup() noexcept
|
||||
{
|
||||
timespec t;
|
||||
clock_gettime (CLOCK_MONOTONIC, &t);
|
||||
|
||||
@@ -1200,8 +1200,8 @@ public:
|
||||
dest = result.getCharPointer();
|
||||
}
|
||||
|
||||
StringCreationHelper (const String::CharPointerType& source_)
|
||||
: source (source_), dest (nullptr), allocatedBytes (StringHolder::getAllocatedNumBytes (source)), bytesWritten (0)
|
||||
StringCreationHelper (const String::CharPointerType s)
|
||||
: source (s), dest (nullptr), allocatedBytes (StringHolder::getAllocatedNumBytes (s)), bytesWritten (0)
|
||||
{
|
||||
result.preallocateBytes (allocatedBytes);
|
||||
dest = result.getCharPointer();
|
||||
@@ -1531,7 +1531,8 @@ String String::quoted (const beast_wchar quoteCharacter) const
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
static String::CharPointerType findTrimmedEnd (const String::CharPointerType& start, String::CharPointerType end)
|
||||
static String::CharPointerType findTrimmedEnd (const String::CharPointerType start,
|
||||
String::CharPointerType end)
|
||||
{
|
||||
while (end > start)
|
||||
{
|
||||
|
||||
@@ -30,14 +30,14 @@ struct TextDiffHelpers
|
||||
StringRegion (const String& s) noexcept
|
||||
: text (s.getCharPointer()), start (0), length (s.length()) {}
|
||||
|
||||
StringRegion (const String::CharPointerType& t, int s, int len) noexcept
|
||||
StringRegion (const String::CharPointerType t, int s, int len) noexcept
|
||||
: text (t), start (s), length (len) {}
|
||||
|
||||
String::CharPointerType text;
|
||||
int start, length;
|
||||
};
|
||||
|
||||
static void addInsertion (TextDiff& td, const String::CharPointerType& text, int index, int length)
|
||||
static void addInsertion (TextDiff& td, const String::CharPointerType text, int index, int length)
|
||||
{
|
||||
TextDiff::Change c;
|
||||
c.insertedText = String (text, (size_t) length);
|
||||
@@ -99,7 +99,7 @@ struct TextDiffHelpers
|
||||
}
|
||||
|
||||
static int findLongestCommonSubstring (String::CharPointerType a, const int lenA,
|
||||
const String::CharPointerType& b, const int lenB,
|
||||
const String::CharPointerType b, const int lenB,
|
||||
int& indexInA, int& indexInB)
|
||||
{
|
||||
if (lenA == 0 || lenB == 0)
|
||||
|
||||
90
TODO.txt
90
TODO.txt
@@ -1,7 +1,55 @@
|
||||
--------------------------------------------------------------------------------
|
||||
LEVELDB TODO
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
- Add VisualStudio 2012 project file to our fork
|
||||
|
||||
- Add LevelDB unity .cpp and .h to our fork
|
||||
|
||||
- Replace Beast specific platform macros with universal macros so that the
|
||||
unity doesn't require Beast
|
||||
|
||||
- Submit LevelDB fork changes to Bitcoin upstream
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
WEBSOCKET TODO
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
*** Figure out how hard we want to fork websocket first **
|
||||
|
||||
- Think about stripping the ripple specifics out of AutoSocket, make AutoSocket
|
||||
part of our websocketpp fork
|
||||
|
||||
- Regroup all the sources together in one directory
|
||||
|
||||
- Strip includes and enforce unity
|
||||
|
||||
- Put a new front-end on websocket to hide ALL of their classes and templates
|
||||
from the host application, make this part of the websocket fork
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
RIPPLE TODO
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
- Remove dependence on JobQueue, LoadFeeTrack, and NetworkOPs from LoadManager
|
||||
by providing an observer (beast::ListenerList or Listeners). This way
|
||||
LoadManager does not need stopThread() function.
|
||||
|
||||
- Move everything in src/cpp/ripple into ripple_app and sort them into
|
||||
subdirectories within the module as per the project filters.
|
||||
* Make sure there are no pending commits from David
|
||||
|
||||
- Refactor TxFormats into template WireFormats<> and use it for transactions
|
||||
and ledger entries, replace the redundant code with template typedefs.
|
||||
|
||||
- Rewrite Sustain to use Beast and work on Windows as well
|
||||
* Do not enable watchdog process if a debugger is attached
|
||||
|
||||
- Make separate LevelDB VS2012 project for source browsing, leave ony the unity
|
||||
.cpp in the main RippleD project
|
||||
|
||||
- Add LevelDB unity .cpp to the LevelDB fork
|
||||
|
||||
- Make sure the leak detector output appears on Linux and FreeBSD debug builds.
|
||||
|
||||
- Create SharedData <LoadState>, move all load related state variables currently
|
||||
@@ -26,7 +74,7 @@ RIPPLE TODO
|
||||
|
||||
- Replace all NULL with nullptr
|
||||
|
||||
- Add ICore interface
|
||||
- Add ICore interface (incremental replacement for IApplication)
|
||||
|
||||
- Make TxFormats a member of ICore instead of a singleton.
|
||||
PROBLEM: STObject derived classes like STInt16 make direct use of the
|
||||
@@ -79,27 +127,29 @@ RIPPLE TODO
|
||||
|
||||
- Consolidate SQLite database classes: DatabaseCon, Database, SqliteDatabase.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
RANDOM NOTES
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
LoadEvent
|
||||
|
||||
Is referenced with both a shared pointer and an auto pointer.
|
||||
Should be named LoadMeter::ScopedSample
|
||||
Should be named LoadMeter::ScopedSample. Or possibly ScopedLoadSample
|
||||
|
||||
JobQueue
|
||||
|
||||
getLoadEvent and getLoadEventAP differ only in the style of pointer
|
||||
container which is returned. Unnecessary complexity.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Naming
|
||||
|
||||
Some names don't make sense.
|
||||
Naming: Some names don't make sense.
|
||||
|
||||
Index
|
||||
Stop using Index to refer to keys in tables. Replace with "Key" ?
|
||||
Index implies a small integer, or a data structure.
|
||||
|
||||
This is all over the place in the Ledger API, "Index" of this and
|
||||
"Index" of that, the terminology is imprecise and helps neither
|
||||
understanding nor recall.
|
||||
|
||||
Inconsistent names
|
||||
|
||||
@@ -123,8 +173,7 @@ Ledger "Skip List"
|
||||
Duplicate Code
|
||||
|
||||
LedgerEntryFormat and TxFormat
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
* Resolved with a todo item, create WireFormats<> template class.
|
||||
|
||||
Interfaces
|
||||
|
||||
@@ -142,8 +191,6 @@ Interfaces
|
||||
|
||||
We have beast for InputStream and OutputStream, we can use those now.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
boost
|
||||
|
||||
Unclear from the class declaration what style of shared object management
|
||||
@@ -156,7 +203,28 @@ boost
|
||||
boost::recursive_mutex
|
||||
|
||||
Recursive mutexes should never be necessary.
|
||||
|
||||
They require the "mutable" keyword for const members to acquire the lock (yuck)
|
||||
|
||||
Replace recursive_mutex with beast::Mutex to remove boost dependency
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Davidisms
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(Figure out a good place to record information like this permanently)
|
||||
|
||||
Regarding a defect where a failing transaction was being submitted over and over
|
||||
again on the network (July 3, 2013)
|
||||
|
||||
The core problem was an interaction between two bits of logic.
|
||||
1) Normally, we won't relay a transaction again if we already recently relayed
|
||||
it. But this is bypassed if the transaction failed in a way that could
|
||||
allow it to succeed later. This way, if one server discovers a transaction
|
||||
can now work, it can get all servers to retry it.
|
||||
2) Normally, we won't relay a transaction if we think it can't claim a fee.
|
||||
But if we're not sure it can't claim a fee because we're in an unhealthy
|
||||
state, we propagate the transaction to let other servers decide if they
|
||||
think it can claim a fee.
|
||||
With these two bits of logic, two unhealthy servers could infinitely propagate
|
||||
a transaction back and forth between each other.
|
||||
|
||||
@@ -178,11 +178,11 @@ namespace ripple
|
||||
#include "src/cpp/ripple/SerializedValidation.h"
|
||||
#include "src/cpp/ripple/AccountSetTransactor.h"
|
||||
#include "src/cpp/ripple/TrustSetTransactor.h"
|
||||
#include "src/cpp/ripple/ripple_Version.h"
|
||||
#include "src/cpp/ripple/WSConnection.h"
|
||||
#include "src/cpp/ripple/WSHandler.h"
|
||||
#include "src/cpp/ripple/WalletAddTransactor.h"
|
||||
|
||||
#include "basics/ripple_Version.h" // VFALCO TODO Should this be private?
|
||||
#include "basics/ripple_BuildVersion.h" // private
|
||||
|
||||
}
|
||||
@@ -228,36 +228,21 @@ static const uint64 tenTo17m1 = tenTo17 - 1;
|
||||
|
||||
#if ! defined (RIPPLE_MAIN_PART) || RIPPLE_MAIN_PART == 1
|
||||
|
||||
#include "src/cpp/ripple/RPCHandler.cpp"
|
||||
#include "src/cpp/ripple/Ledger.cpp"
|
||||
#include "src/cpp/ripple/ripple_SHAMap.cpp" // Uses theApp
|
||||
#include "src/cpp/ripple/ripple_SHAMapDelta.cpp"
|
||||
#include "src/cpp/ripple/ripple_SHAMapItem.cpp"
|
||||
#include "src/cpp/ripple/ripple_SHAMapNode.cpp"
|
||||
#include "src/cpp/ripple/ripple_SHAMapSync.cpp"
|
||||
#include "src/cpp/ripple/ripple_SHAMapTreeNode.cpp"
|
||||
#include "src/cpp/ripple/ripple_SHAMapMissingNode.cpp"
|
||||
|
||||
#include "src/cpp/ripple/ripple_Database.cpp"
|
||||
#include "src/cpp/ripple/ripple_AccountItem.cpp"
|
||||
#include "src/cpp/ripple/ripple_AccountItems.cpp"
|
||||
#include "src/cpp/ripple/AccountSetTransactor.cpp"
|
||||
#include "src/cpp/ripple/ripple_AccountState.cpp"
|
||||
#include "src/cpp/ripple/ripple_CanonicalTXSet.cpp"
|
||||
#include "src/cpp/ripple/ChangeTransactor.cpp"
|
||||
#include "src/cpp/ripple/Contract.cpp"
|
||||
#include "src/cpp/ripple/ripple_DBInit.cpp"
|
||||
#include "src/cpp/ripple/HTTPRequest.cpp"
|
||||
#include "src/cpp/ripple/Interpreter.cpp"
|
||||
#include "src/cpp/ripple/LedgerProposal.cpp"
|
||||
#include "src/cpp/ripple/LedgerTiming.cpp"
|
||||
#include "src/cpp/ripple/ripple_LoadManager.cpp"
|
||||
#include "src/cpp/ripple/ripple_Main.cpp"
|
||||
#include "src/cpp/ripple/ripple_NicknameState.cpp"
|
||||
#include "src/cpp/ripple/ripple_Offer.cpp"
|
||||
#include "src/cpp/ripple/OfferCancelTransactor.cpp"
|
||||
#include "src/cpp/ripple/Operation.cpp"
|
||||
#include "src/cpp/ripple/OrderBookDB.cpp"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -265,6 +250,29 @@ static const uint64 tenTo17m1 = tenTo17 - 1;
|
||||
|
||||
#if ! defined (RIPPLE_MAIN_PART) || RIPPLE_MAIN_PART == 2
|
||||
|
||||
#include "src/cpp/ripple/RPCHandler.cpp"
|
||||
#include "src/cpp/ripple/ripple_SHAMap.cpp" // Uses theApp
|
||||
#include "src/cpp/ripple/ripple_SHAMapItem.cpp"
|
||||
#include "src/cpp/ripple/ripple_SHAMapSync.cpp"
|
||||
#include "src/cpp/ripple/ripple_SHAMapMissingNode.cpp"
|
||||
|
||||
#include "src/cpp/ripple/ripple_AccountItem.cpp"
|
||||
#include "src/cpp/ripple/AccountSetTransactor.cpp"
|
||||
#include "src/cpp/ripple/ripple_CanonicalTXSet.cpp"
|
||||
#include "src/cpp/ripple/Contract.cpp"
|
||||
#include "src/cpp/ripple/HTTPRequest.cpp"
|
||||
#include "src/cpp/ripple/LedgerProposal.cpp"
|
||||
#include "src/cpp/ripple/ripple_LoadManager.cpp"
|
||||
#include "src/cpp/ripple/ripple_NicknameState.cpp"
|
||||
#include "src/cpp/ripple/OfferCancelTransactor.cpp"
|
||||
#include "src/cpp/ripple/OrderBookDB.cpp"
|
||||
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if ! defined (RIPPLE_MAIN_PART) || RIPPLE_MAIN_PART == 3
|
||||
|
||||
// This is for PeerDoor and WSDoor
|
||||
// Generate DH for SSL connection.
|
||||
static DH* handleTmpDh (SSL* ssl, int is_export, int iKeyLength)
|
||||
@@ -274,61 +282,22 @@ static DH* handleTmpDh (SSL* ssl, int is_export, int iKeyLength)
|
||||
}
|
||||
|
||||
#include "src/cpp/ripple/ripple_RippleCalc.cpp"
|
||||
#include "src/cpp/ripple/ripple_UniqueNodeList.cpp"
|
||||
#include "src/cpp/ripple/CallRPC.cpp"
|
||||
#include "src/cpp/ripple/ripple_InboundLedger.cpp"
|
||||
#include "src/cpp/ripple/ripple_PathState.cpp"
|
||||
#include "src/cpp/ripple/ripple_SqliteDatabase.cpp"
|
||||
|
||||
#include "src/cpp/ripple/ParameterTable.cpp"
|
||||
#include "src/cpp/ripple/PaymentTransactor.cpp"
|
||||
#include "src/cpp/ripple/PeerDoor.cpp"
|
||||
#include "src/cpp/ripple/RegularKeySetTransactor.cpp"
|
||||
#include "src/cpp/ripple/ripple_RippleLineCache.cpp"
|
||||
#include "src/cpp/ripple/ripple_RippleState.cpp"
|
||||
#include "src/cpp/ripple/rpc.cpp"
|
||||
#include "src/cpp/ripple/RPCDoor.cpp"
|
||||
#include "src/cpp/ripple/RPCErr.cpp"
|
||||
#include "src/cpp/ripple/RPCServer.cpp"
|
||||
#include "src/cpp/ripple/RPCSub.cpp"
|
||||
#include "src/cpp/ripple/ScriptData.cpp"
|
||||
#include "src/cpp/ripple/SerializedValidation.cpp"
|
||||
#include "src/cpp/ripple/SNTPClient.cpp"
|
||||
#include "src/cpp/ripple/Transaction.cpp"
|
||||
#include "src/cpp/ripple/TransactionCheck.cpp"
|
||||
#include "src/cpp/ripple/TransactionEngine.cpp"
|
||||
#include "src/cpp/ripple/TransactionMaster.cpp"
|
||||
#include "src/cpp/ripple/TransactionMeta.cpp"
|
||||
#include "src/cpp/ripple/TransactionQueue.cpp"
|
||||
#include "src/cpp/ripple/Transactor.cpp"
|
||||
#include "src/cpp/ripple/TrustSetTransactor.cpp"
|
||||
#include "src/cpp/ripple/WSConnection.cpp"
|
||||
#include "src/cpp/ripple/WSDoor.cpp"
|
||||
#include "src/cpp/ripple/WSHandler.cpp"
|
||||
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if ! defined (RIPPLE_MAIN_PART) || RIPPLE_MAIN_PART == 3
|
||||
|
||||
#include "src/cpp/ripple/ripple_Peer.cpp"
|
||||
#include "src/cpp/ripple/ripple_LedgerEntrySet.cpp"
|
||||
#include "src/cpp/ripple/ripple_Application.cpp"
|
||||
#include "src/cpp/ripple/ripple_Pathfinder.cpp"
|
||||
#include "src/cpp/ripple/OfferCreateTransactor.cpp"
|
||||
#include "src/cpp/ripple/ripple_Features.cpp"
|
||||
#include "src/cpp/ripple/ripple_Validations.cpp"
|
||||
|
||||
#include "src/cpp/ripple/ripple_LocalCredentials.cpp"
|
||||
#include "src/cpp/ripple/WalletAddTransactor.cpp"
|
||||
#include "src/cpp/ripple/ripple_HashedObject.cpp"
|
||||
#include "src/cpp/ripple/ripple_AcceptedLedgerTx.cpp"
|
||||
#include "src/cpp/ripple/ripple_AcceptedLedger.cpp"
|
||||
#include "src/cpp/ripple/ripple_DatabaseCon.cpp"
|
||||
#include "src/cpp/ripple/ripple_DisputedTx.cpp"
|
||||
#include "src/cpp/ripple/ripple_FeeVote.cpp"
|
||||
#include "src/cpp/ripple/ripple_HashRouter.cpp"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -336,25 +305,88 @@ static DH* handleTmpDh (SSL* ssl, int is_export, int iKeyLength)
|
||||
|
||||
#if ! defined (RIPPLE_MAIN_PART) || RIPPLE_MAIN_PART == 4
|
||||
|
||||
#include "src/cpp/ripple/ripple_UniqueNodeList.cpp"
|
||||
#include "src/cpp/ripple/ripple_InboundLedger.cpp"
|
||||
#include "src/cpp/ripple/ripple_SqliteDatabase.cpp"
|
||||
|
||||
#include "src/cpp/ripple/PaymentTransactor.cpp"
|
||||
#include "src/cpp/ripple/RegularKeySetTransactor.cpp"
|
||||
#include "src/cpp/ripple/ripple_RippleState.cpp"
|
||||
#include "src/cpp/ripple/RPCDoor.cpp"
|
||||
#include "src/cpp/ripple/RPCServer.cpp"
|
||||
#include "src/cpp/ripple/ScriptData.cpp"
|
||||
#include "src/cpp/ripple/SNTPClient.cpp"
|
||||
#include "src/cpp/ripple/TransactionCheck.cpp"
|
||||
#include "src/cpp/ripple/TransactionMaster.cpp"
|
||||
#include "src/cpp/ripple/TransactionQueue.cpp"
|
||||
#include "src/cpp/ripple/TrustSetTransactor.cpp"
|
||||
#include "src/cpp/ripple/WSHandler.cpp"
|
||||
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if ! defined (RIPPLE_MAIN_PART) || RIPPLE_MAIN_PART == 5
|
||||
|
||||
#include "src/cpp/ripple/ripple_Peer.cpp"
|
||||
#include "src/cpp/ripple/ripple_Application.cpp"
|
||||
#include "src/cpp/ripple/OfferCreateTransactor.cpp"
|
||||
#include "src/cpp/ripple/ripple_Validations.cpp"
|
||||
|
||||
#include "src/cpp/ripple/WalletAddTransactor.cpp"
|
||||
#include "src/cpp/ripple/ripple_AcceptedLedgerTx.cpp"
|
||||
#include "src/cpp/ripple/ripple_DatabaseCon.cpp"
|
||||
#include "src/cpp/ripple/ripple_FeeVote.cpp"
|
||||
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if ! defined (RIPPLE_MAIN_PART) || RIPPLE_MAIN_PART == 6
|
||||
|
||||
#include "src/cpp/ripple/ripple_LedgerEntrySet.cpp"
|
||||
#include "src/cpp/ripple/ripple_Pathfinder.cpp"
|
||||
#include "src/cpp/ripple/ripple_Features.cpp"
|
||||
|
||||
#include "src/cpp/ripple/ripple_LocalCredentials.cpp"
|
||||
#include "src/cpp/ripple/ripple_HashedObject.cpp"
|
||||
#include "src/cpp/ripple/ripple_AcceptedLedger.cpp"
|
||||
#include "src/cpp/ripple/ripple_DisputedTx.cpp"
|
||||
#include "src/cpp/ripple/ripple_HashRouter.cpp"
|
||||
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if ! defined (RIPPLE_MAIN_PART) || RIPPLE_MAIN_PART == 7
|
||||
|
||||
#include "src/cpp/ripple/NetworkOPs.cpp"
|
||||
#include "src/cpp/ripple/ripple_LedgerConsensus.cpp"
|
||||
#include "src/cpp/ripple/ripple_Peers.cpp"
|
||||
#include "src/cpp/ripple/LedgerMaster.cpp"
|
||||
#include "src/cpp/ripple/ripple_HashedObjectStore.cpp"
|
||||
#include "src/cpp/ripple/HttpsClient.cpp"
|
||||
|
||||
#include "src/cpp/ripple/ripple_InboundLedgers.cpp"
|
||||
#include "src/cpp/ripple/ripple_InfoSub.cpp"
|
||||
#include "src/cpp/ripple/ripple_LedgerHistory.cpp"
|
||||
#include "src/cpp/ripple/ripple_OrderBook.cpp"
|
||||
#include "src/cpp/ripple/ripple_PathRequest.cpp"
|
||||
#include "src/cpp/ripple/ripple_SerializedLedger.cpp"
|
||||
#include "src/cpp/ripple/ripple_TransactionAcquire.cpp"
|
||||
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if ! defined (RIPPLE_MAIN_PART) || RIPPLE_MAIN_PART == 8
|
||||
|
||||
#include "src/cpp/ripple/ripple_LedgerConsensus.cpp"
|
||||
#include "src/cpp/ripple/LedgerMaster.cpp"
|
||||
#include "src/cpp/ripple/HttpsClient.cpp"
|
||||
|
||||
#include "src/cpp/ripple/ripple_InfoSub.cpp"
|
||||
#include "src/cpp/ripple/ripple_OrderBook.cpp"
|
||||
#include "src/cpp/ripple/ripple_PeerSet.cpp"
|
||||
#include "src/cpp/ripple/ripple_ProofOfWork.cpp"
|
||||
#include "src/cpp/ripple/ripple_ProofOfWorkFactory.h" // private
|
||||
#include "src/cpp/ripple/ripple_ProofOfWorkFactory.cpp"
|
||||
#include "src/cpp/ripple/ripple_SerializedLedger.cpp"
|
||||
#include "src/cpp/ripple/ripple_ProofOfWorkFactory.cpp" // requires ProofOfWork.cpp for ProofOfWork::sMaxDifficulty
|
||||
#include "src/cpp/ripple/ripple_SerializedTransaction.cpp"
|
||||
#include "src/cpp/ripple/ripple_TransactionAcquire.cpp"
|
||||
|
||||
#include "src/cpp/ripple/ripple_SHAMapSyncFilters.cpp" // requires Application
|
||||
|
||||
@@ -366,7 +398,7 @@ static DH* handleTmpDh (SSL* ssl, int is_export, int iKeyLength)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if ! defined (RIPPLE_MAIN_PART) || RIPPLE_MAIN_PART == 4
|
||||
#if ! defined (RIPPLE_MAIN_PART) || RIPPLE_MAIN_PART == 8
|
||||
|
||||
// Unit Tests
|
||||
//
|
||||
@@ -377,7 +409,7 @@ static DH* handleTmpDh (SSL* ssl, int is_export, int iKeyLength)
|
||||
#include "src/cpp/ripple/LedgerUnitTests.cpp"
|
||||
#include "src/cpp/ripple/ripple_SHAMapUnitTests.cpp"
|
||||
#include "src/cpp/ripple/ripple_SHAMapSyncUnitTests.cpp"
|
||||
#include "src/cpp/ripple/ripple_ProofOfWorkFactoryUnitTests.cpp"
|
||||
#include "src/cpp/ripple/ripple_ProofOfWorkFactoryUnitTests.cpp" // Requires ProofOfWorkFactory.h
|
||||
#include "src/cpp/ripple/ripple_SerializedTransactionUnitTests.cpp"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
8
modules/ripple_app/ripple_app_pt5.cpp
Normal file
8
modules/ripple_app/ripple_app_pt5.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#define RIPPLE_MAIN_PART 5
|
||||
#include "ripple_app.cpp"
|
||||
8
modules/ripple_app/ripple_app_pt6.cpp
Normal file
8
modules/ripple_app/ripple_app_pt6.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#define RIPPLE_MAIN_PART 6
|
||||
#include "ripple_app.cpp"
|
||||
8
modules/ripple_app/ripple_app_pt7.cpp
Normal file
8
modules/ripple_app/ripple_app_pt7.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#define RIPPLE_MAIN_PART 7
|
||||
#include "ripple_app.cpp"
|
||||
8
modules/ripple_app/ripple_app_pt8.cpp
Normal file
8
modules/ripple_app/ripple_app_pt8.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#define RIPPLE_MAIN_PART 8
|
||||
#include "ripple_app.cpp"
|
||||
@@ -155,6 +155,7 @@ void Log::print (std::string const& text, bool toStdErr)
|
||||
|
||||
if (toStdErr)
|
||||
{
|
||||
#if BEAST_MSVC
|
||||
if (beast_isRunningUnderDebugger ())
|
||||
{
|
||||
// Send it to the attached debugger's Output window
|
||||
@@ -162,6 +163,7 @@ void Log::print (std::string const& text, bool toStdErr)
|
||||
Logger::outputDebugString (text);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
std::cerr << text << std::endl;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ TxFormats::Item const* TxFormats::findByName (std::string const& name) const noe
|
||||
|
||||
TxFormats::Item& TxFormats::add (char const* name, TxType type)
|
||||
{
|
||||
Item& item = m_formats.add (new Item (name, type));
|
||||
Item& item = *m_formats.add (new Item (name, type));
|
||||
|
||||
addCommonFields (item);
|
||||
|
||||
|
||||
@@ -266,7 +266,20 @@ private:
|
||||
};
|
||||
|
||||
Application::Application ()
|
||||
//
|
||||
// VFALCO NOTE Change this to control whether or not the Application
|
||||
// object is destroyed on exit
|
||||
//
|
||||
#if 1
|
||||
// Application object will be deleted on exit. If the code doesn't exit
|
||||
// cleanly this could cause hangs or crashes on exit.
|
||||
//
|
||||
: SharedSingleton <Application> (SingletonLifetime::persistAfterCreation)
|
||||
#else
|
||||
// This will make it so that the Application object is not deleted on exit.
|
||||
//
|
||||
: SharedSingleton <Application> (SingletonLifetime::neverDestroyed)
|
||||
#endif
|
||||
, mIOService ((theConfig.NODE_SIZE >= 2) ? 2 : 1)
|
||||
, mIOWork (mIOService)
|
||||
, mAuxWork (mAuxService)
|
||||
@@ -308,6 +321,21 @@ Application::Application ()
|
||||
HashMaps::getInstance ().initializeNonce <size_t> ();
|
||||
}
|
||||
|
||||
Application::~Application ()
|
||||
{
|
||||
// VFALCO TODO Wrap these in ScopedPointer
|
||||
delete mTxnDB;
|
||||
delete mLedgerDB;
|
||||
delete mWalletDB;
|
||||
delete mHashNodeDB;
|
||||
delete mNetNodeDB;
|
||||
delete mPathFindDB;
|
||||
delete mHashNodeLDB;
|
||||
|
||||
if (mEphemeralLDB != nullptr)
|
||||
delete mEphemeralLDB;
|
||||
}
|
||||
|
||||
// VFALCO TODO Tidy these up into some class with accessors.
|
||||
//
|
||||
extern const char* RpcDBInit[], *TxnDBInit[], *LedgerDBInit[], *WalletDBInit[], *HashNodeDBInit[],
|
||||
@@ -666,10 +694,18 @@ void Application::run ()
|
||||
if (mWSPrivateDoor)
|
||||
mWSPrivateDoor->stop ();
|
||||
|
||||
getApp().getLoadManager().stopThread();
|
||||
// VFALCO TODO Try to not have to do this early, by using observers to
|
||||
// eliminate LoadManager's dependency inversions.
|
||||
//
|
||||
// This deletes the object and therefore, stops the thread.
|
||||
m_loadManager = nullptr;
|
||||
|
||||
mSweepTimer.cancel();
|
||||
|
||||
WriteLog (lsINFO, Application) << "Done.";
|
||||
|
||||
// VFALCO NOTE This is a sign that something is wrong somewhere, it
|
||||
// shouldn't be necessary to sleep until some flag is set.
|
||||
while (mShutdown)
|
||||
boost::this_thread::sleep (boost::posix_time::milliseconds (100));
|
||||
}
|
||||
@@ -705,21 +741,6 @@ void Application::sweep ()
|
||||
mSweepTimer.async_wait (BIND_TYPE (&Application::sweep, this));
|
||||
}
|
||||
|
||||
Application::~Application ()
|
||||
{
|
||||
// VFALCO TODO Wrap these in ScopedPointer
|
||||
delete mTxnDB;
|
||||
delete mLedgerDB;
|
||||
delete mWalletDB;
|
||||
delete mHashNodeDB;
|
||||
delete mNetNodeDB;
|
||||
delete mPathFindDB;
|
||||
delete mHashNodeLDB;
|
||||
|
||||
if (mEphemeralLDB != nullptr)
|
||||
delete mEphemeralLDB;
|
||||
}
|
||||
|
||||
void Application::startNewLedger ()
|
||||
{
|
||||
// New stuff.
|
||||
|
||||
@@ -208,23 +208,27 @@ class ILoadManager
|
||||
public:
|
||||
/** Create a new manager.
|
||||
|
||||
The manager thread begins running immediately.
|
||||
|
||||
@note The thresholds for warnings and punishments are in
|
||||
the ctor-initializer
|
||||
*/
|
||||
static ILoadManager* New ();
|
||||
|
||||
/** Destroy the manager.
|
||||
|
||||
The destructor returns only after the thread has stopped.
|
||||
*/
|
||||
virtual ~ILoadManager () { }
|
||||
|
||||
/** Start the associated thread.
|
||||
|
||||
This is here to prevent the deadlock detector from activating during
|
||||
a lengthy program initialization.
|
||||
|
||||
@note In stand-alone mode, this might not get called.
|
||||
*/
|
||||
// VFALCO TODO Simplify the two stage initialization to one stage (construction).
|
||||
// NOTE In stand-alone mode the load manager thread isn't started
|
||||
virtual void startThread () = 0;
|
||||
virtual void stopThread () = 0;
|
||||
|
||||
/** Turn on deadlock detection.
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@ public:
|
||||
, mDebitWarn (-500)
|
||||
, mDebitLimit (-1000)
|
||||
, mArmed (false)
|
||||
, mRunning (false)
|
||||
, mDeadLock (0)
|
||||
, mCosts (LT_MAX)
|
||||
{
|
||||
@@ -110,6 +109,8 @@ public:
|
||||
|
||||
addCost (Cost (LT_RequestData, -5, flagDisk | flagNet));
|
||||
addCost (Cost (LT_CheapQuery, -1, flagCpu));
|
||||
|
||||
UptimeTimer::getInstance ().beginManualUpdates ();
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -117,29 +118,12 @@ private:
|
||||
{
|
||||
UptimeTimer::getInstance ().endManualUpdates ();
|
||||
|
||||
if (mRunning)
|
||||
{
|
||||
m_thread.interrupt ();
|
||||
m_thread.join ();
|
||||
}
|
||||
m_thread.interrupt ();
|
||||
}
|
||||
|
||||
void startThread ()
|
||||
{
|
||||
UptimeTimer::getInstance ().beginManualUpdates ();
|
||||
|
||||
m_thread.start (this);
|
||||
mRunning = true;
|
||||
}
|
||||
|
||||
void stopThread()
|
||||
{
|
||||
if (mRunning)
|
||||
{
|
||||
m_thread.interrupt ();
|
||||
m_thread.join ();
|
||||
mRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
void canonicalize (LoadSource& source, int now) const
|
||||
@@ -417,7 +401,7 @@ private:
|
||||
int mDebitWarn; // when a source drops below this, we warn
|
||||
int mDebitLimit; // when a source drops below this, we cut it off (should be negative)
|
||||
|
||||
bool mArmed, mRunning;
|
||||
bool mArmed;
|
||||
|
||||
int mDeadLock; // Detect server deadlocks
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ bool powResultInfo (POWResult powCode, std::string& strToken, std::string& strHu
|
||||
return iIndex >= 0;
|
||||
}
|
||||
|
||||
// VFALCO TODO Move these to a header because they are used by ripple_ProofOfWorkFactory.cpp
|
||||
const uint256 ProofOfWork::sMinTarget ("00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
|
||||
const int ProofOfWork::sMaxIterations (1 << 23);
|
||||
const int ProofOfWork::sMaxDifficulty (30);
|
||||
|
||||
Reference in New Issue
Block a user