Merge branch 'master' of github.com:jedmccaleb/NewCoin

Conflicts:
	src/FieldNames.cpp

This is guaranteed safe. Shortly, I'll change it to call a constructor
that doesn't acquire the mutex.
This commit is contained in:
JoelKatz
2012-10-05 13:07:09 -07:00
5 changed files with 95 additions and 44 deletions

View File

@@ -3,16 +3,22 @@
#
import glob
import platform
CTAGS = '/usr/bin/exuberant-ctags'
OSX = bool(platform.mac_ver()[0])
if OSX:
CTAGS = '/usr/bin/ctags'
else:
CTAGS = '/usr/bin/exuberant-ctags'
#
# scons tools
#
env = Environment(
tools = ['default', 'protoc']
)
tools = ['default', 'protoc']
)
# Use clang
#env.Replace(CC = 'clang')
@@ -23,73 +29,83 @@ env = Environment(
#
ctags = Builder(action = '$CTAGS $CTAGSOPTIONS -f $TARGET $SOURCES')
env.Append(BUILDERS = { 'CTags' : ctags })
env.Replace(CTAGS = CTAGS, CTAGSOPTIONS = '--tag-relative')
if OSX:
env.Replace(CTAGS = CTAGS)
else:
env.Replace(CTAGS = CTAGS, CTAGSOPTIONS = '--tag-relative')
#
# Put objects files in their own directory.
#
for dir in ['src', 'database', 'json', 'websocketpp']:
VariantDir('obj/'+dir, dir, duplicate=0)
VariantDir('obj/'+dir, dir, duplicate=0)
# Use openssl
env.ParseConfig('pkg-config --cflags --libs openssl')
env.Append(LIBS = [
'boost_date_time-mt',
'boost_filesystem-mt',
'boost_program_options-mt',
'boost_regex-mt',
'boost_system-mt',
'boost_thread-mt',
'protobuf',
'dl', # dynamic linking
'z'
])
env.Append(
LIBS = [
'boost_date_time-mt',
'boost_filesystem-mt',
'boost_program_options-mt',
'boost_regex-mt',
'boost_system-mt',
'boost_thread-mt',
'protobuf',
'dl', # dynamic linking
'z'
]
)
DEBUGFLAGS = ['-g', '-DDEBUG']
BOOSTFLAGS = ['-DBOOST_TEST_DYN_LINK', '-DBOOST_FILESYSTEM_NO_DEPRECATED']
DEBUGFLAGS = ['-g', '-DDEBUG']
BOOSTFLAGS = ['-DBOOST_TEST_DYN_LINK', '-DBOOST_FILESYSTEM_NO_DEPRECATED']
env.Append(LINKFLAGS = ['-rdynamic', '-pthread'])
env.Append(CCFLAGS = ['-pthread', '-Wall', '-Wno-sign-compare', '-Wno-char-subscripts', '-DSQLITE_THREADSAFE'])
env.Append(CXXFLAGS = ['-O0', '-pthread', '-Wno-invalid-offsetof', '-Wformat']+BOOSTFLAGS+DEBUGFLAGS)
DB_SRCS = glob.glob('database/*.c') + glob.glob('database/*.cpp')
JSON_SRCS = glob.glob('json/*.cpp')
WEBSOCKETPP_SRCS = [
'websocketpp/src/base64/base64.cpp',
'websocketpp/src/md5/md5.c',
'websocketpp/src/messages/data.cpp',
'websocketpp/src/network_utilities.cpp',
'websocketpp/src/processors/hybi_header.cpp',
'websocketpp/src/processors/hybi_util.cpp',
'websocketpp/src/sha1/sha1.cpp',
'websocketpp/src/uri.cpp'
]
if OSX:
env.Append(LINKFLAGS = ['-L/usr/local/Cellar/openssl/1.0.1c/lib'])
env.Append(CXXFLAGS = ['-I/usr/local/Cellar/openssl/1.0.1c/include'])
NEWCOIN_SRCS = glob.glob('src/*.cpp')
PROTO_SRCS = env.Protoc([], 'src/newcoin.proto', PROTOCOUTDIR='obj', PROTOCPYTHONOUTDIR=None)
DB_SRCS = glob.glob('database/*.c') + glob.glob('database/*.cpp')
JSON_SRCS = glob.glob('json/*.cpp')
WEBSOCKETPP_SRCS = [
'websocketpp/src/base64/base64.cpp',
'websocketpp/src/md5/md5.c',
'websocketpp/src/messages/data.cpp',
'websocketpp/src/network_utilities.cpp',
'websocketpp/src/processors/hybi_header.cpp',
'websocketpp/src/processors/hybi_util.cpp',
'websocketpp/src/sha1/sha1.cpp',
'websocketpp/src/uri.cpp'
]
NEWCOIN_SRCS = glob.glob('src/*.cpp')
PROTO_SRCS = env.Protoc([], 'src/newcoin.proto', PROTOCOUTDIR='obj', PROTOCPYTHONOUTDIR=None)
env.Clean(PROTO_SRCS, 'site_scons/site_tools/protoc.pyc')
# Remove unused source files.
UNUSED_SRCS = ['src/HttpReply.cpp']
UNUSED_SRCS = ['src/HttpReply.cpp']
for file in UNUSED_SRCS:
NEWCOIN_SRCS.remove(file)
NEWCOIN_SRCS.remove(file)
NEWCOIN_SRCS += DB_SRCS + JSON_SRCS + WEBSOCKETPP_SRCS
NEWCOIN_SRCS += DB_SRCS + JSON_SRCS + WEBSOCKETPP_SRCS
# Derive the object files from the source files.
NEWCOIN_OBJS = []
NEWCOIN_OBJS = []
for file in NEWCOIN_SRCS:
NEWCOIN_OBJS.append('obj/' + file)
NEWCOIN_OBJS.append('obj/' + file)
NEWCOIN_OBJS += PROTO_SRCS
NEWCOIN_OBJS += PROTO_SRCS
newcoind = env.Program('newcoind', NEWCOIN_OBJS)
newcoind = env.Program('newcoind', NEWCOIN_OBJS)
tags = env.CTags('obj/tags', NEWCOIN_SRCS)
tags = env.CTags('obj/tags', NEWCOIN_SRCS)
Default(newcoind, tags)

View File

@@ -103,10 +103,10 @@
<ClCompile Include="src\Config.cpp" />
<ClCompile Include="src\ConnectionPool.cpp" />
<ClCompile Include="src\Contract.cpp" />
<ClCompile Include="src\Conversion.cpp" />
<ClCompile Include="src\DBInit.cpp" />
<ClCompile Include="src\DeterministicKeys.cpp" />
<ClCompile Include="src\ECIES.cpp" />
<ClCompile Include="src\FieldNames.cpp" />
<ClCompile Include="src\HashedObject.cpp" />
<ClCompile Include="src\HttpsClient.cpp" />
<ClCompile Include="src\Interpreter.cpp" />
@@ -136,6 +136,7 @@
<ClCompile Include="src\PubKeyCache.cpp" />
<ClCompile Include="src\RequestParser.cpp" />
<ClCompile Include="src\rfc1751.cpp" />
<ClCompile Include="src\RippleCalc.cpp" />
<ClCompile Include="src\RippleLines.cpp" />
<ClCompile Include="src\RippleState.cpp" />
<ClCompile Include="src\rpc.cpp" />
@@ -156,7 +157,9 @@
<ClCompile Include="src\SNTPClient.cpp" />
<ClCompile Include="src\Suppression.cpp" />
<ClCompile Include="src\Transaction.cpp" />
<ClCompile Include="src\TransactionAction.cpp" />
<ClCompile Include="src\TransactionEngine.cpp" />
<ClCompile Include="src\TransactionErr.cpp" />
<ClCompile Include="src\TransactionFormats.cpp" />
<ClCompile Include="src\TransactionMaster.cpp" />
<ClCompile Include="src\TransactionMeta.cpp" />
@@ -270,6 +273,7 @@
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\protoc-2.4.1-win32\protoc -I=..\newcoin\src --cpp_out=..\newcoin\obj\src ..\newcoin\src\newcoin.proto</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">obj\src\newcoin.pb.h</Outputs>
</CustomBuild>
<None Include="README" />
<None Include="SConstruct" />
<None Include="validators.txt" />
<None Include="wallet.xml" />

View File

@@ -63,9 +63,6 @@
<ClCompile Include="src\ConnectionPool.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Conversion.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\DBInit.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -294,6 +291,18 @@
<ClCompile Include="src\Operation.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\FieldNames.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\TransactionAction.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\RippleCalc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\TransactionErr.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="KnownNodeList.h">
@@ -557,6 +566,7 @@
<None Include="SConstruct" />
<None Include="newcoind.cfg" />
<None Include="validators.txt" />
<None Include="README" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="src\newcoin.proto" />

View File

@@ -34,6 +34,8 @@ SField::ref SField::getField(int code)
if ((type <= 0) || (field <= 0))
return sfInvalid;
boost::mutex::scoped_lock sl(mapMutex);
boost::recursive_mutex::scoped_lock sl(mapMutex);
std::map<int, SField::ptr>::iterator it = codeToField.find(code);

View File

@@ -18,13 +18,32 @@
#define isSetBit(x,y) (!!((x) & (y)))
// maybe use http://www.mail-archive.com/licq-commits@googlegroups.com/msg02334.html
#ifdef WIN32
extern uint64_t htobe64(uint64_t value);
extern uint64_t be64toh(uint64_t value);
extern uint32_t htobe32(uint32_t value);
extern uint32_t be32toh(uint32_t value);
#elif __APPLE__
#include <libkern/OSByteOrder.h>
#define htobe16(x) OSSwapHostToBigInt16(x)
#define htole16(x) OSSwapHostToLittleInt16(x)
#define be16toh(x) OSSwapBigToHostInt16(x)
#define le16toh(x) OSSwapLittleToHostInt16(x)
#define htobe32(x) OSSwapHostToBigInt32(x)
#define htole32(x) OSSwapHostToLittleInt32(x)
#define be32toh(x) OSSwapBigToHostInt32(x)
#define le32toh(x) OSSwapLittleToHostInt32(x)
#define htobe64(x) OSSwapHostToBigInt64(x)
#define htole64(x) OSSwapHostToLittleInt64(x)
#define be64toh(x) OSSwapBigToHostInt64(x)
#define le64toh(x) OSSwapLittleToHostInt64(x)
#endif
#define vt_f_black "\033[30m"
#define vt_f_red "\033[31m"
#define vt_f_green "\033[32m"