This commit is contained in:
jed
2012-11-12 15:45:50 -08:00
parent c7d88f5078
commit 433cbc4d92
5 changed files with 66 additions and 52 deletions

View File

@@ -20,12 +20,14 @@
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@@ -49,13 +51,13 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>BOOST_TEST_ALTERNATIVE_INIT_API;BOOST_TEST_NO_MAIN;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\src;..\OpenSSL\include;..\boost_1_47_0;..\protobuf-2.4.1\src\</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>.\;..\OpenSSL\include;..\boost_1_52_0;..\protobuf\src</AdditionalIncludeDirectories>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>..\OpenSSL\lib\VC;..\boost_1_47_0\stage\lib;..\protobuf-2.4.1\vsprojects\Debug</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>..\OpenSSL\lib\VC;..\boost_1_52_0\stage\lib;..\protobuf\vsprojects\Debug</AdditionalLibraryDirectories>
<AdditionalDependencies>ssleay32MDd.lib;libeay32MTd.lib;libprotobuf.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent>
@@ -137,9 +139,7 @@
<ClCompile Include="src\cpp\ripple\PubKeyCache.cpp" />
<ClCompile Include="src\cpp\ripple\RangeSet.cpp" />
<ClCompile Include="src\cpp\ripple\rfc1751.cpp" />
<ClCompile Include="src\cpp\ripple\ripple.pb.cc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\;..\OpenSSL\include;..\boost_1_47_0;..\protobuf-2.4.1\src\</AdditionalIncludeDirectories>
</ClCompile>
<ClCompile Include="src\cpp\ripple\ripple.pb.cc" />
<ClCompile Include="src\cpp\ripple\RippleAddress.cpp" />
<ClCompile Include="src\cpp\ripple\RippleCalc.cpp" />
<ClCompile Include="src\cpp\ripple\RippleLines.cpp" />
@@ -175,14 +175,16 @@
<ClCompile Include="src\cpp\ripple\Wallet.cpp" />
<ClCompile Include="src\cpp\ripple\WSConnection.cpp" />
<ClCompile Include="src\cpp\ripple\WSDoor.cpp" />
<ClCompile Include="websocketpp\src\base64\base64.cpp" />
<ClCompile Include="websocketpp\src\md5\md5.c" />
<ClCompile Include="websocketpp\src\messages\data.cpp" />
<ClCompile Include="websocketpp\src\network_utilities.cpp" />
<ClCompile Include="websocketpp\src\processors\hybi_header.cpp" />
<ClCompile Include="websocketpp\src\processors\hybi_util.cpp" />
<ClCompile Include="websocketpp\src\sha1\sha1.cpp" />
<ClCompile Include="websocketpp\src\uri.cpp" />
<ClCompile Include="src\cpp\websocketpp\src\base64\base64.cpp" />
<ClCompile Include="src\cpp\websocketpp\src\md5\md5.c" />
<ClCompile Include="src\cpp\websocketpp\src\messages\data.cpp" />
<ClCompile Include="src\cpp\websocketpp\src\network_utilities.cpp" />
<ClCompile Include="src\cpp\websocketpp\src\processors\hybi_header.cpp" />
<ClCompile Include="src\cpp\websocketpp\src\processors\hybi_util.cpp" />
<ClCompile Include="src\cpp\websocketpp\src\rng\blank_rng.cpp" />
<ClCompile Include="src\cpp\websocketpp\src\rng\boost_rng.cpp" />
<ClCompile Include="src\cpp\websocketpp\src\sha1\sha1.cpp" />
<ClCompile Include="src\cpp\websocketpp\src\uri.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="bitcoinUtil.h" />
@@ -287,7 +289,7 @@
<None Include="SConstruct" />
<CustomBuild Include="src\cpp\ripple\ripple.proto">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/code/protoc-2.4.1-win32/protoc -I=..\newcoin --cpp_out=\code\newcoin\ ..\newcoin/src/cpp/ripple/ripple.proto</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/code/protobuf/protoc -I=..\newcoin --cpp_out=\code\newcoin\ ..\newcoin/src/cpp/ripple/ripple.proto</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\code\newcoin\src\ripple.pb.h</Outputs>
</CustomBuild>
<None Include="test\buster.js" />

View File

@@ -33,30 +33,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="websocketpp\src\base64\base64.cpp">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
<ClCompile Include="websocketpp\src\md5\md5.c">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
<ClCompile Include="websocketpp\src\messages\data.cpp">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
<ClCompile Include="websocketpp\src\network_utilities.cpp">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
<ClCompile Include="websocketpp\src\processors\hybi_header.cpp">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
<ClCompile Include="websocketpp\src\processors\hybi_util.cpp">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
<ClCompile Include="websocketpp\src\uri.cpp">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
<ClCompile Include="websocketpp\src\sha1\sha1.cpp">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
<ClCompile Include="src\cpp\database\database.cpp">
<Filter>Source Files\database</Filter>
</ClCompile>
@@ -318,6 +294,36 @@
<ClCompile Include="src\cpp\database\sqlite3.c">
<Filter>Source Files\database</Filter>
</ClCompile>
<ClCompile Include="src\cpp\websocketpp\src\uri.cpp">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
<ClCompile Include="src\cpp\websocketpp\src\network_utilities.cpp">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
<ClCompile Include="src\cpp\websocketpp\src\base64\base64.cpp">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
<ClCompile Include="src\cpp\websocketpp\src\md5\md5.c">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
<ClCompile Include="src\cpp\websocketpp\src\messages\data.cpp">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
<ClCompile Include="src\cpp\websocketpp\src\processors\hybi_header.cpp">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
<ClCompile Include="src\cpp\websocketpp\src\processors\hybi_util.cpp">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
<ClCompile Include="src\cpp\websocketpp\src\rng\blank_rng.cpp">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
<ClCompile Include="src\cpp\websocketpp\src\rng\boost_rng.cpp">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
<ClCompile Include="src\cpp\websocketpp\src\sha1\sha1.cpp">
<Filter>Source Files\websocketpp</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="util\pugiconfig.hpp">

View File

@@ -181,9 +181,9 @@ bool TransactionAcquire::takeNodes(const std::list<SHAMapNode>& nodeIDs,
}
void LCTransaction::setVote(const uint160& peer, bool votesYes)
{ // Tracke a peer's yes/no vote on a particular disputed transaction
std::pair<boost::unordered_map<uint160, bool>::iterator, bool> res =
mVotes.insert(std::make_pair<uint160, bool>(peer, votesYes));
{ // Track a peer's yes/no vote on a particular disputed transaction
std::pair<boost::unordered_map<const uint160, bool>::iterator, bool> res =
mVotes.insert(std::pair<const uint160, bool>(peer, votesYes));
if (res.second)
{ // new vote

View File

@@ -1,3 +1,6 @@
#ifndef __RPC_h__
#define __RPC_h__
#include <string>
#include <map>
@@ -37,3 +40,5 @@ extern std::string HTTPReply(int nStatus, const std::string& strMsg);
extern std::string JSONRPCReply(const Json::Value& result, const Json::Value& error, const Json::Value& id);
extern Json::Value JSONRPCError(int code, const std::string& message);
#endif

View File

@@ -31,7 +31,8 @@ public:
typedef boost::weak_ptr<data_type> weak_data_ptr;
typedef boost::shared_ptr<data_type> data_ptr;
typedef std::pair<time_t, data_ptr> cache_entry;
typedef std::pair<time_t, weak_data_ptr> cache_entry;
typedef std::pair<key_type, cache_entry> cache_pair;
protected:
mutable boost::recursive_mutex mLock;
@@ -156,7 +157,7 @@ template<typename c_Key, typename c_Data> bool TaggedCache<c_Key, c_Data>::touch
}
// In map but not cache, put in cache
mCache.insert(std::make_pair(key, std::make_pair(time(NULL), weak_data_ptr(cit->second.second))));
mCache.insert(cache_pair(key, cache_entry(time(NULL), weak_data_ptr(cit->second.second))));
return true;
}
@@ -180,7 +181,7 @@ bool TaggedCache<c_Key, c_Data>::canonicalize(const key_type& key, boost::shared
typename boost::unordered_map<key_type, weak_data_ptr>::iterator mit = mMap.find(key);
if (mit == mMap.end())
{ // not in map
mCache.insert(std::make_pair(key, std::make_pair(time(NULL), data)));
mCache.insert(cache_pair(key, cache_entry(time(NULL), data)));
mMap.insert(std::make_pair(key, data));
return false;
}
@@ -189,7 +190,7 @@ bool TaggedCache<c_Key, c_Data>::canonicalize(const key_type& key, boost::shared
if (!cachedData)
{ // in map, but expired. Update in map, insert in cache
mit->second = data;
mCache.insert(std::make_pair(key, std::make_pair(time(NULL), data)));
mCache.insert(cache_pair(key, cache_entry(time(NULL), data)));
return true;
}
@@ -208,7 +209,7 @@ bool TaggedCache<c_Key, c_Data>::canonicalize(const key_type& key, boost::shared
cit->second.second = data;
}
else // no, add to cache
mCache.insert(std::make_pair(key, std::make_pair(time(NULL), data)));
mCache.insert(cache_pair(key, cache_entry(time(NULL), data)));
return true;
}
@@ -235,7 +236,7 @@ boost::shared_ptr<c_Data> TaggedCache<c_Key, c_Data>::fetch(const key_type& key)
if (cit != mCache.end())
cit->second.first = time(NULL); // Yes, refresh
else // No, add to cache
mCache.insert(std::make_pair(key, std::make_pair(time(NULL), cachedData)));
mCache.insert(cache_pair(key, cache_entry(time(NULL), cachedData)));
return cachedData;
}