mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-04 19:25:51 +00:00
Compare commits
224 Commits
0.27.2
...
0.28.0-rc1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba737d7e58 | ||
|
|
88f69204c8 | ||
|
|
4cf3157aad | ||
|
|
b1f6cb349b | ||
|
|
0c134582ca | ||
|
|
acf2833362 | ||
|
|
20f9971096 | ||
|
|
cefeaceef0 | ||
|
|
1ba7c4b6ee | ||
|
|
1b49776819 | ||
|
|
41c68f4bbc | ||
|
|
56ac830405 | ||
|
|
ebcf821d81 | ||
|
|
e874a2624f | ||
|
|
03d1c0ed21 | ||
|
|
1b8c77eee0 | ||
|
|
d575cd50b1 | ||
|
|
2b040569e7 | ||
|
|
7a53f86fff | ||
|
|
a90bb53cd2 | ||
|
|
b450d62138 | ||
|
|
1a9d65c52a | ||
|
|
05f4746bbe | ||
|
|
1c587723fa | ||
|
|
b2a9c79de5 | ||
|
|
64259c7bcb | ||
|
|
a7efdb4e52 | ||
|
|
091ff0cce0 | ||
|
|
7e25a3a942 | ||
|
|
b3254e2b18 | ||
|
|
9a0fa79144 | ||
|
|
352db260b2 | ||
|
|
f072b5b679 | ||
|
|
b4058a813b | ||
|
|
b27e152ead | ||
|
|
936e83759d | ||
|
|
18fdc175c6 | ||
|
|
47c6ab0ced | ||
|
|
4868135d47 | ||
|
|
5e70db651d | ||
|
|
1fedede771 | ||
|
|
00596f1436 | ||
|
|
db840b5604 | ||
|
|
45070d0e51 | ||
|
|
8a1081f9ef | ||
|
|
ac84e44161 | ||
|
|
836dfb6503 | ||
|
|
35a8ce2349 | ||
|
|
bb7d68b3b9 | ||
|
|
1979846e5e | ||
|
|
a61ffab3f9 | ||
|
|
698fe73608 | ||
|
|
0083c32629 | ||
|
|
f313caaa73 | ||
|
|
6e3f07ddce | ||
|
|
11d28c4856 | ||
|
|
e9394ca85a | ||
|
|
9445a30e72 | ||
|
|
185b1a3d36 | ||
|
|
1c2f5d60a5 | ||
|
|
2f32910bef | ||
|
|
8de1b20bb5 | ||
|
|
60a7abcef6 | ||
|
|
e44e75fa6b | ||
|
|
ff7dc0b446 | ||
|
|
f813cb2310 | ||
|
|
cba19d7e23 | ||
|
|
9479c0e12d | ||
|
|
65c9c45ec6 | ||
|
|
6d79004d4f | ||
|
|
97623d20c5 | ||
|
|
d37802a42f | ||
|
|
9b837a24aa | ||
|
|
d0ef2f7dd8 | ||
|
|
c7cfd23580 | ||
|
|
7cf1ec3f89 | ||
|
|
9708a12607 | ||
|
|
92812fe723 | ||
|
|
79417ac59a | ||
|
|
984f66e083 | ||
|
|
ef2a436769 | ||
|
|
7f1a95550f | ||
|
|
803f5b5613 | ||
|
|
8ca9fa1c26 | ||
|
|
3b3b897193 | ||
|
|
6c364f63cc | ||
|
|
6b9e842ddd | ||
|
|
8f88d915ba | ||
|
|
eaa1f47f00 | ||
|
|
cbeae85731 | ||
|
|
84e618b3f2 | ||
|
|
382a16ff07 | ||
|
|
7bd339b645 | ||
|
|
70d8b2c4b7 | ||
|
|
3764a83c6b | ||
|
|
c3d200ddcd | ||
|
|
44c5e337ab | ||
|
|
040982e321 | ||
|
|
6c81ea846c | ||
|
|
d082a0696d | ||
|
|
f999839e59 | ||
|
|
f1bc662a24 | ||
|
|
232693419a | ||
|
|
ed66b951c6 | ||
|
|
70c2854f7c | ||
|
|
e9381ddeb2 | ||
|
|
1b46e003c3 | ||
|
|
4611d5a35f | ||
|
|
2e59378ab7 | ||
|
|
fc8bf39043 | ||
|
|
2cccd8ab28 | ||
|
|
d537ceedd6 | ||
|
|
ac7243b309 | ||
|
|
607e983f37 | ||
|
|
02f7326b7e | ||
|
|
b688f69031 | ||
|
|
df41329df9 | ||
|
|
0825bd7076 | ||
|
|
e9b7003cf5 | ||
|
|
c5d673c426 | ||
|
|
9f64ad8d89 | ||
|
|
e5b0b7e9a7 | ||
|
|
9c3522cb70 | ||
|
|
b357390215 | ||
|
|
c66fc2f656 | ||
|
|
64554aca6d | ||
|
|
f1df9a02fa | ||
|
|
f3725bdd2e | ||
|
|
cb92b94d55 | ||
|
|
ef01f82e0c | ||
|
|
4ba7ee8c92 | ||
|
|
c59633a588 | ||
|
|
f56e37398c | ||
|
|
e43ffa6f2b | ||
|
|
6991bc9723 | ||
|
|
9d6106a80b | ||
|
|
9e70404411 | ||
|
|
bc48d299b6 | ||
|
|
a8db5650a5 | ||
|
|
91871b418b | ||
|
|
aaf98082e9 | ||
|
|
ac228deeda | ||
|
|
fc661c83ef | ||
|
|
a2acffdfa3 | ||
|
|
79ce4ed226 | ||
|
|
e3a7aa0033 | ||
|
|
fde6303ae6 | ||
|
|
b4a1948951 | ||
|
|
b927028416 | ||
|
|
fe5d1ff6c5 | ||
|
|
1308656000 | ||
|
|
ec1e6b9385 | ||
|
|
315a8b6b60 | ||
|
|
558c6b621b | ||
|
|
6d91d02c62 | ||
|
|
436ded68b7 | ||
|
|
3ec88b3665 | ||
|
|
2caedb38a6 | ||
|
|
49378ab7fe | ||
|
|
982dc6aa8c | ||
|
|
33175187b7 | ||
|
|
0339904920 | ||
|
|
8bda9487c6 | ||
|
|
617d84c0ef | ||
|
|
b11ad375cd | ||
|
|
7a6d533014 | ||
|
|
be44f75d2d | ||
|
|
ab14123aed | ||
|
|
a963a6d10d | ||
|
|
69b4cd22a2 | ||
|
|
958325653f | ||
|
|
c5dc419f9e | ||
|
|
2a201f9525 | ||
|
|
b7ba509618 | ||
|
|
f946d7b447 | ||
|
|
e2a5535ed6 | ||
|
|
62c5b5e570 | ||
|
|
feaa0871ac | ||
|
|
9f41976926 | ||
|
|
1784f24c5f | ||
|
|
fc47d9fc4d | ||
|
|
eade9f8f2b | ||
|
|
f4dcbe3a84 | ||
|
|
9c02cc1b17 | ||
|
|
0cc3ef8f90 | ||
|
|
4cbbacc946 | ||
|
|
9a0c71d4a7 | ||
|
|
0f1b831de7 | ||
|
|
37a7a2aacd | ||
|
|
635b157b11 | ||
|
|
c3ae4da83a | ||
|
|
c3809ece67 | ||
|
|
bfc436dccd | ||
|
|
71d6874236 | ||
|
|
9bf1f994ae | ||
|
|
bb4127a6fb | ||
|
|
a691632995 | ||
|
|
5d6ea3d75f | ||
|
|
43873b1b2c | ||
|
|
9430f3665b | ||
|
|
f3c1f63444 | ||
|
|
b5c7232d6f | ||
|
|
2f3677d593 | ||
|
|
1e0efaffe8 | ||
|
|
fc79754750 | ||
|
|
0e4de42be8 | ||
|
|
4e389127b5 | ||
|
|
47593730d6 | ||
|
|
e742da73bd | ||
|
|
890bf3cce1 | ||
|
|
60eb312e3b | ||
|
|
06207da185 | ||
|
|
4dc2cf8a6b | ||
|
|
44450bf644 | ||
|
|
312aec79ca | ||
|
|
a8578c73f8 | ||
|
|
c522ffa6db | ||
|
|
93b7599b1c | ||
|
|
3ccbd7c9b2 | ||
|
|
385a87db31 | ||
|
|
5530353eef | ||
|
|
d1193093ef | ||
|
|
b203db27a4 | ||
|
|
0a3e1af04c |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -75,4 +75,7 @@ My Amplifier XE Results - RippleD
|
||||
/out.txt
|
||||
|
||||
# Build Log
|
||||
rippled-build.log
|
||||
rippled-build.log
|
||||
|
||||
# Profiling data
|
||||
gmon.out
|
||||
|
||||
23
Builds/Docker/Dockerfile-testnet
Normal file
23
Builds/Docker/Dockerfile-testnet
Normal file
@@ -0,0 +1,23 @@
|
||||
FROM ubuntu
|
||||
MAINTAINER Torrie Fischer <torrie@ripple.com>
|
||||
|
||||
RUN apt-get update -qq &&\
|
||||
apt-get install -qq software-properties-common &&\
|
||||
apt-add-repository -y ppa:ubuntu-toolchain-r/test &&\
|
||||
apt-add-repository -y ppa:afrank/boost &&\
|
||||
apt-get update -qq
|
||||
|
||||
RUN apt-get purge -qq libboost1.48-dev &&\
|
||||
apt-get install -qq libprotobuf8 libboost1.57-all-dev
|
||||
|
||||
RUN mkdir -p /srv/rippled/data
|
||||
|
||||
VOLUME /srv/rippled/data/
|
||||
|
||||
ENTRYPOINT ["/srv/rippled/bin/rippled"]
|
||||
CMD ["--conf", "/srv/rippled/data/rippled.cfg"]
|
||||
EXPOSE 51235/udp
|
||||
EXPOSE 5005/tcp
|
||||
|
||||
ADD ./rippled.cfg /srv/rippled/data/rippled.cfg
|
||||
ADD ./rippled /srv/rippled/bin/
|
||||
180
Builds/Test.py
Executable file
180
Builds/Test.py
Executable file
@@ -0,0 +1,180 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# This file is part of rippled: https://github.com/ripple/rippled
|
||||
# Copyright (c) 2012 - 2015 Ripple Labs Inc.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
"""
|
||||
Invocation:
|
||||
./Builds/Test.py - builds and tests all configurations
|
||||
|
||||
#
|
||||
# The build must succeed without shell aliases for this to work.
|
||||
#
|
||||
# Common problems:
|
||||
# 1) Boost not found. Solution: export BOOST_ROOT=[path to boost folder]
|
||||
# 2) OpenSSL not found. Solution: export OPENSSL_ROOT=[path to OpenSSL folder]
|
||||
# 3) scons is an alias. Solution: Create a script named "scons" somewhere in
|
||||
# your $PATH (eg. ~/bin/scons will often work).
|
||||
# #!/bin/sh
|
||||
# python /C/Python27/Scripts/scons.py "${@}"
|
||||
"""
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
import argparse
|
||||
import itertools
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
IS_WINDOWS = platform.system().lower() == 'windows'
|
||||
|
||||
if IS_WINDOWS:
|
||||
BINARY_RE = re.compile(r'build\\([^\\]+)\\rippled.exe')
|
||||
|
||||
else:
|
||||
BINARY_RE = re.compile(r'build/([^/]+)/rippled')
|
||||
|
||||
ALL_TARGETS = ['debug', 'release']
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Test.py - run ripple tests'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--all', '-a',
|
||||
action='store_true',
|
||||
help='Build all configurations.',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--keep_going', '-k',
|
||||
action='store_true',
|
||||
help='Keep going after one configuration has failed.',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--silent', '-s',
|
||||
action='store_true',
|
||||
help='Silence all messages except errors',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--verbose', '-v',
|
||||
action='store_true',
|
||||
help=('Report more information about which commands are executed and the '
|
||||
'results.'),
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--test', '-t',
|
||||
default='',
|
||||
help='Add a prefix for unit tests',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'scons_args',
|
||||
default=(),
|
||||
nargs='*'
|
||||
)
|
||||
|
||||
ARGS = parser.parse_args()
|
||||
|
||||
def shell(*cmd, **kwds):
|
||||
"Execute a shell command and return the output."
|
||||
silent = kwds.pop('silent', ARGS.silent)
|
||||
verbose = not silent and kwds.pop('verbose', ARGS.verbose)
|
||||
if verbose:
|
||||
print('$', ' '.join(cmd))
|
||||
kwds['shell'] = IS_WINDOWS
|
||||
|
||||
process = subprocess.Popen(
|
||||
cmd,
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
**kwds)
|
||||
lines = []
|
||||
count = 0
|
||||
for line in process.stdout:
|
||||
lines.append(line)
|
||||
if verbose:
|
||||
print(line, end='')
|
||||
elif not silent:
|
||||
count += 1
|
||||
if count >= 80:
|
||||
print()
|
||||
count = 0
|
||||
else:
|
||||
print('.', end='')
|
||||
|
||||
if not verbose and count:
|
||||
print()
|
||||
process.wait()
|
||||
return process.returncode, lines
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = list(ARGS.scons_args)
|
||||
if ARGS.all:
|
||||
for a in ALL_TARGETS:
|
||||
if a not in args:
|
||||
args.append(a)
|
||||
print('Building:', *(args or ['(default)']))
|
||||
|
||||
# Build everything.
|
||||
resultcode, lines = shell('scons', *args)
|
||||
if resultcode:
|
||||
print('Build FAILED:')
|
||||
if not ARGS.verbose:
|
||||
print(*lines, sep='')
|
||||
exit(1)
|
||||
|
||||
# Now extract the executable names and corresponding targets.
|
||||
failed = []
|
||||
_, lines = shell('scons', '-n', '--tree=derived', *args, silent=True)
|
||||
for line in lines:
|
||||
match = BINARY_RE.search(line)
|
||||
if match:
|
||||
executable, target = match.group(0, 1)
|
||||
|
||||
print('Unit tests for', target)
|
||||
testflag = '--unittest'
|
||||
if ARGS.test:
|
||||
testflag += ('=' + ARGS.test)
|
||||
|
||||
resultcode, lines = shell(executable, testflag)
|
||||
if resultcode:
|
||||
print('ERROR:', *lines, sep='')
|
||||
failed.append([target, 'unittest'])
|
||||
if not ARGS.keep_going:
|
||||
break
|
||||
ARGS.verbose and print(*lines, sep='')
|
||||
|
||||
print('npm tests for', target)
|
||||
resultcode, lines = shell('npm', 'test', '--rippled=' + executable)
|
||||
if resultcode:
|
||||
print('ERROR:\n', *lines, sep='')
|
||||
failed.append([target, 'npm'])
|
||||
if not ARGS.keep_going:
|
||||
break
|
||||
else:
|
||||
ARGS.verbose and print(*lines, sep='')
|
||||
|
||||
if failed:
|
||||
print('FAILED:', *(':'.join(f) for f in failed))
|
||||
exit(1)
|
||||
else:
|
||||
print('Success')
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -7,20 +7,20 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RippleD", "RippleD.vcxproj"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
debug.classic|x64 = debug.classic|x64
|
||||
debug|x64 = debug|x64
|
||||
release.classic|x64 = release.classic|x64
|
||||
release|x64 = release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.Debug|Win32.ActiveCfg = debug|x64
|
||||
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.Debug|Win32.Build.0 = debug|x64
|
||||
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.Debug|x64.ActiveCfg = debug|x64
|
||||
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.Debug|x64.Build.0 = debug|x64
|
||||
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.Release|Win32.ActiveCfg = release|x64
|
||||
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.Release|Win32.Build.0 = release|x64
|
||||
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.Release|x64.ActiveCfg = release|x64
|
||||
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.Release|x64.Build.0 = release|x64
|
||||
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.debug.classic|x64.ActiveCfg = debug.classic|x64
|
||||
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.debug.classic|x64.Build.0 = debug.classic|x64
|
||||
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.debug|x64.ActiveCfg = debug|x64
|
||||
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.debug|x64.Build.0 = debug|x64
|
||||
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.release.classic|x64.ActiveCfg = release.classic|x64
|
||||
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.release.classic|x64.Build.0 = release.classic|x64
|
||||
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.release|x64.ActiveCfg = release|x64
|
||||
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.release|x64.Build.0 = release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Name: rippled
|
||||
Version: 0.27.2
|
||||
Version: 0.28.0-rc1
|
||||
Release: 1%{?dist}
|
||||
Summary: Ripple peer-to-peer network daemon
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ lowest practical level.
|
||||
**What can you do with Ripple?**
|
||||
|
||||
The protocol is entirely open-source and the network’s shared ledger is public
|
||||
information, so no central authority prevents anyone from participating.Anyone
|
||||
information, so no central authority prevents anyone from participating. Anyone
|
||||
can become a market maker, create a wallet or a gateway, or monitor network
|
||||
behavior. Competition drives down spreads and fees, making the network useful
|
||||
to everyone.
|
||||
@@ -49,12 +49,12 @@ to everyone.
|
||||
1. XRP is Ripple’s native [cryptocurrency]
|
||||
(http://en.wikipedia.org/wiki/Cryptocurrency) with a fixed supply that
|
||||
decreases slowly over time, with no mining. XRP acts as a bridge currency, and
|
||||
pays for transaction fees that protect the network against spam
|
||||
pays for transaction fees that protect the network against spam.
|
||||

|
||||
|
||||
2. Pathfinding discovers cheap and efficient payment paths through multiple
|
||||
[order books](https://www.ripplecharts.com) allowing anyone to [trade](https://www.rippletrade.com) anything. When two accounts aren’t linked by relationships of trust, the Ripple pathfinding engine considers intermediate links and order books to produce a set of possible paths the transaction can take. When the payment is processed, the liquidity along these paths is iteratively consumed in best-first order.
|
||||

|
||||

|
||||
|
||||
3. [Consensus](https://www.youtube.com/watch?v=pj1QVb1vlC0) confirms
|
||||
transactions in an atomic fashion, without mining, ensuring efficient use of
|
||||
@@ -84,6 +84,9 @@ This is the repository for Ripple's `rippled`, reference P2P server.
|
||||
###Setup instructions:
|
||||
* https://ripple.com/wiki/Rippled_setup_instructions
|
||||
|
||||
###Issues
|
||||
* https://ripplelabs.atlassian.net/browse/RIPD
|
||||
|
||||
### Repository Contents
|
||||
|
||||
#### ./bin
|
||||
|
||||
271
SConstruct
271
SConstruct
@@ -40,6 +40,26 @@ If the clang toolchain is detected, then the default target will use it, else
|
||||
the gcc toolchain will be used. On Windows environments, the MSVC toolchain is
|
||||
also detected.
|
||||
|
||||
The following environment variables modify the build environment:
|
||||
CLANG_CC
|
||||
CLANG_CXX
|
||||
CLANG_LINK
|
||||
If set, a clang toolchain will be used. These must all be set together.
|
||||
|
||||
GNU_CC
|
||||
GNU_CXX
|
||||
GNU_LINK
|
||||
If set, a gcc toolchain will be used (unless a clang toolchain is
|
||||
detected first). These must all be set together.
|
||||
|
||||
CXX
|
||||
If set, used to detect a toolchain.
|
||||
|
||||
BOOST_ROOT
|
||||
Path to the boost directory.
|
||||
OPENSSL_ROOT
|
||||
Path to the openssl directory.
|
||||
|
||||
'''
|
||||
#
|
||||
'''
|
||||
@@ -93,6 +113,29 @@ def check_openssl():
|
||||
(CHECK_LINE, CHECK_COMMAND))
|
||||
|
||||
|
||||
def set_implicit_cache():
|
||||
'''Use implicit_cache on some targets to improve build times.
|
||||
|
||||
By default, scons scans each file for include dependecies. The implicit
|
||||
cache flag lets you cache these dependencies for later builds, and will
|
||||
only rescan files that change.
|
||||
|
||||
Failure cases are:
|
||||
1) If the include search paths are changed (i.e. CPPPATH), then a file
|
||||
may not be rebuilt.
|
||||
2) If a same-named file has been added to a directory that is earlier in
|
||||
the search path than the directory in which the file was found.
|
||||
Turn on if this build is for a specific debug target (i.e. clang.debug)
|
||||
|
||||
If one of the failure cases applies, you can force a rescan of dependencies
|
||||
using the command line option `--implicit-deps-changed`
|
||||
'''
|
||||
if len(COMMAND_LINE_TARGETS) == 1:
|
||||
s = COMMAND_LINE_TARGETS[0].split('.')
|
||||
if len(s) > 1 and 'debug' in s:
|
||||
SetOption('implicit_cache', 1)
|
||||
|
||||
|
||||
def import_environ(env):
|
||||
'''Imports environment settings into the construction environment'''
|
||||
def set(keys):
|
||||
@@ -212,6 +255,7 @@ def config_base(env):
|
||||
env.Append(CPPDEFINES=[
|
||||
'OPENSSL_NO_SSL2'
|
||||
,'DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER'
|
||||
,{'HAVE_USLEEP' : '1'}
|
||||
])
|
||||
|
||||
try:
|
||||
@@ -486,6 +530,7 @@ def config_env(toolchain, variant, env):
|
||||
# Configure the base construction environment
|
||||
root_dir = Dir('#').srcnode().get_abspath() # Path to this SConstruct file
|
||||
build_dir = os.path.join('build')
|
||||
|
||||
base = Environment(
|
||||
toolpath=[os.path.join ('src', 'beast', 'site_scons', 'site_tools')],
|
||||
tools=['default', 'Protoc', 'VSProject'],
|
||||
@@ -497,8 +542,12 @@ base.Append(CPPPATH=[
|
||||
'src',
|
||||
os.path.join('src', 'beast'),
|
||||
os.path.join(build_dir, 'proto'),
|
||||
os.path.join('src','soci','src'),
|
||||
])
|
||||
|
||||
base.Decider('MD5-timestamp')
|
||||
set_implicit_cache()
|
||||
|
||||
# Configure the toolchains, variants, default toolchain, and default target
|
||||
variants = ['debug', 'release', 'profile']
|
||||
all_toolchains = ['clang', 'gcc', 'msvc']
|
||||
@@ -564,13 +613,140 @@ def list_sources(base, suffixes):
|
||||
yield os.path.normpath(path)
|
||||
return list(_iter(base))
|
||||
|
||||
|
||||
def append_sources(result, *filenames, **kwds):
|
||||
result.append([filenames, kwds])
|
||||
|
||||
|
||||
def get_soci_sources(style):
|
||||
result = []
|
||||
cpp_path = [
|
||||
'src/soci/src/core',
|
||||
'src/sqlite', ]
|
||||
append_sources(result,
|
||||
'src/ripple/unity/soci.cpp',
|
||||
CPPPATH=cpp_path)
|
||||
if style == 'unity':
|
||||
append_sources(result,
|
||||
'src/ripple/unity/soci_ripple.cpp',
|
||||
CPPPATH=cpp_path)
|
||||
return result
|
||||
|
||||
|
||||
def get_classic_sources():
|
||||
result = []
|
||||
append_sources(
|
||||
result,
|
||||
*list_sources('src/ripple/app', '.cpp'),
|
||||
CPPPATH=[
|
||||
'src/soci/src/core',
|
||||
'src/sqlite']
|
||||
)
|
||||
append_sources(result, *list_sources('src/ripple/basics', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/core', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/crypto', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/json', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/legacy', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/net', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/overlay', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/peerfinder', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/protocol', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/shamap', '.cpp'))
|
||||
append_sources(
|
||||
result,
|
||||
*list_sources('src/ripple/nodestore', '.cpp'),
|
||||
CPPPATH=[
|
||||
'src/rocksdb2/include',
|
||||
'src/snappy/snappy',
|
||||
'src/snappy/config',
|
||||
])
|
||||
|
||||
result += get_soci_sources('classic')
|
||||
return result
|
||||
|
||||
|
||||
def get_unity_sources():
|
||||
result = []
|
||||
append_sources(
|
||||
result,
|
||||
'src/ripple/unity/app.cpp',
|
||||
'src/ripple/unity/app1.cpp',
|
||||
'src/ripple/unity/app2.cpp',
|
||||
'src/ripple/unity/app3.cpp',
|
||||
'src/ripple/unity/app4.cpp',
|
||||
'src/ripple/unity/app5.cpp',
|
||||
'src/ripple/unity/app6.cpp',
|
||||
'src/ripple/unity/app7.cpp',
|
||||
'src/ripple/unity/app8.cpp',
|
||||
'src/ripple/unity/app9.cpp',
|
||||
'src/ripple/unity/core.cpp',
|
||||
'src/ripple/unity/basics.cpp',
|
||||
'src/ripple/unity/crypto.cpp',
|
||||
'src/ripple/unity/net.cpp',
|
||||
'src/ripple/unity/overlay.cpp',
|
||||
'src/ripple/unity/peerfinder.cpp',
|
||||
'src/ripple/unity/json.cpp',
|
||||
'src/ripple/unity/protocol.cpp',
|
||||
'src/ripple/unity/shamap.cpp',
|
||||
'src/ripple/unity/legacy.cpp',
|
||||
)
|
||||
|
||||
result += get_soci_sources('unity')
|
||||
|
||||
append_sources(
|
||||
result,
|
||||
'src/ripple/unity/nodestore.cpp',
|
||||
CPPPATH=[
|
||||
'src/rocksdb2/include',
|
||||
'src/snappy/snappy',
|
||||
'src/snappy/config',
|
||||
])
|
||||
|
||||
return result
|
||||
|
||||
# Declare the targets
|
||||
aliases = collections.defaultdict(list)
|
||||
msvc_configs = []
|
||||
|
||||
|
||||
def should_prepare_target(cl_target,
|
||||
style, toolchain, variant):
|
||||
if not cl_target:
|
||||
# default target
|
||||
return (style == default_tu_style and
|
||||
toolchain == default_toolchain and
|
||||
variant == default_variant)
|
||||
if 'vcxproj' in cl_target:
|
||||
return toolchain == 'msvc'
|
||||
s = cl_target.split('.')
|
||||
if style == 'unity' and 'nounity' in s:
|
||||
return False
|
||||
if len(s) == 1:
|
||||
return ('all' in cl_target or
|
||||
variant in cl_target or
|
||||
toolchain in cl_target)
|
||||
if len(s) == 2 or len(s) == 3:
|
||||
return s[0] == toolchain and s[1] == variant
|
||||
|
||||
return True # A target we don't know about, better prepare to build it
|
||||
|
||||
|
||||
def should_prepare_targets(style, toolchain, variant):
|
||||
if not COMMAND_LINE_TARGETS:
|
||||
return should_prepare_target(None, style, toolchain, variant)
|
||||
for t in COMMAND_LINE_TARGETS:
|
||||
if should_prepare_target(t, style, toolchain, variant):
|
||||
return True
|
||||
|
||||
for tu_style in ['classic', 'unity']:
|
||||
if tu_style == 'classic':
|
||||
sources = get_classic_sources()
|
||||
else:
|
||||
sources = get_unity_sources()
|
||||
for toolchain in all_toolchains:
|
||||
for variant in variants:
|
||||
if not should_prepare_targets(tu_style, toolchain, variant):
|
||||
continue
|
||||
if variant == 'profile' and toolchain == 'msvc':
|
||||
continue
|
||||
# Configure this variant's construction environment
|
||||
@@ -591,66 +767,8 @@ for tu_style in ['classic', 'unity']:
|
||||
|
||||
object_builder = ObjectBuilder(env, variant_dirs)
|
||||
|
||||
if tu_style == 'classic':
|
||||
object_builder.add_source_files(
|
||||
*list_sources('src/ripple/app', '.cpp'))
|
||||
object_builder.add_source_files(
|
||||
*list_sources('src/ripple/basics', '.cpp'))
|
||||
object_builder.add_source_files(
|
||||
*list_sources('src/ripple/core', '.cpp'))
|
||||
object_builder.add_source_files(
|
||||
*list_sources('src/ripple/crypto', '.cpp'))
|
||||
object_builder.add_source_files(
|
||||
*list_sources('src/ripple/json', '.cpp'))
|
||||
object_builder.add_source_files(
|
||||
*list_sources('src/ripple/net', '.cpp'))
|
||||
object_builder.add_source_files(
|
||||
*list_sources('src/ripple/overlay', '.cpp'))
|
||||
object_builder.add_source_files(
|
||||
*list_sources('src/ripple/peerfinder', '.cpp'))
|
||||
object_builder.add_source_files(
|
||||
*list_sources('src/ripple/protocol', '.cpp'))
|
||||
object_builder.add_source_files(
|
||||
*list_sources('src/ripple/shamap', '.cpp'))
|
||||
object_builder.add_source_files(
|
||||
*list_sources('src/ripple/nodestore', '.cpp'),
|
||||
CPPPATH=[
|
||||
'src/leveldb/include',
|
||||
'src/rocksdb2/include',
|
||||
'src/snappy/snappy',
|
||||
'src/snappy/config',
|
||||
])
|
||||
else:
|
||||
object_builder.add_source_files(
|
||||
'src/ripple/unity/app.cpp',
|
||||
'src/ripple/unity/app1.cpp',
|
||||
'src/ripple/unity/app2.cpp',
|
||||
'src/ripple/unity/app3.cpp',
|
||||
'src/ripple/unity/app4.cpp',
|
||||
'src/ripple/unity/app5.cpp',
|
||||
'src/ripple/unity/app6.cpp',
|
||||
'src/ripple/unity/app7.cpp',
|
||||
'src/ripple/unity/app8.cpp',
|
||||
'src/ripple/unity/app9.cpp',
|
||||
'src/ripple/unity/core.cpp',
|
||||
'src/ripple/unity/basics.cpp',
|
||||
'src/ripple/unity/crypto.cpp',
|
||||
'src/ripple/unity/net.cpp',
|
||||
'src/ripple/unity/overlay.cpp',
|
||||
'src/ripple/unity/peerfinder.cpp',
|
||||
'src/ripple/unity/json.cpp',
|
||||
'src/ripple/unity/protocol.cpp',
|
||||
'src/ripple/unity/shamap.cpp',
|
||||
)
|
||||
|
||||
object_builder.add_source_files(
|
||||
'src/ripple/unity/nodestore.cpp',
|
||||
CPPPATH=[
|
||||
'src/leveldb/include',
|
||||
'src/rocksdb2/include',
|
||||
'src/snappy/snappy',
|
||||
'src/snappy/config',
|
||||
])
|
||||
for s, k in sources:
|
||||
object_builder.add_source_files(*s, **k)
|
||||
|
||||
git_commit_tag = {}
|
||||
if toolchain != 'msvc':
|
||||
@@ -674,7 +792,7 @@ for tu_style in ['classic', 'unity']:
|
||||
'src/ripple/unity/rpcx.cpp',
|
||||
'src/ripple/unity/server.cpp',
|
||||
'src/ripple/unity/validators.cpp',
|
||||
'src/ripple/unity/websocket.cpp'
|
||||
'src/ripple/unity/websocket02.cpp'
|
||||
)
|
||||
|
||||
object_builder.add_source_files(
|
||||
@@ -693,27 +811,6 @@ for tu_style in ['classic', 'unity']:
|
||||
]
|
||||
)
|
||||
|
||||
object_builder.add_source_files(
|
||||
'src/ripple/unity/leveldb.cpp',
|
||||
CPPPATH=[
|
||||
'src/leveldb/',
|
||||
'src/leveldb/include',
|
||||
'src/snappy/snappy',
|
||||
'src/snappy/config',
|
||||
],
|
||||
**no_uninitialized_warning
|
||||
)
|
||||
|
||||
object_builder.add_source_files(
|
||||
'src/ripple/unity/hyperleveldb.cpp',
|
||||
CPPPATH=[
|
||||
'src/hyperleveldb',
|
||||
'src/snappy/snappy',
|
||||
'src/snappy/config',
|
||||
],
|
||||
**no_uninitialized_warning
|
||||
)
|
||||
|
||||
object_builder.add_source_files(
|
||||
'src/ripple/unity/rocksdb.cpp',
|
||||
CPPPATH=[
|
||||
@@ -734,6 +831,11 @@ for tu_style in ['classic', 'unity']:
|
||||
]
|
||||
)
|
||||
|
||||
object_builder.add_source_files(
|
||||
'src/ripple/unity/websocket04.cpp',
|
||||
CPPPATH='src/websocketpp',
|
||||
)
|
||||
|
||||
if toolchain == "clang" and Beast.system.osx:
|
||||
object_builder.add_source_files('src/ripple/unity/beastobjc.mm')
|
||||
|
||||
@@ -756,6 +858,10 @@ for tu_style in ['classic', 'unity']:
|
||||
if toolchain in toolchains:
|
||||
aliases['all'].extend(target)
|
||||
aliases[toolchain].extend(target)
|
||||
elif toolchain == 'msvc':
|
||||
config = env.VSProjectConfig(variant + ".classic", 'x64', target, env)
|
||||
msvc_configs.append(config)
|
||||
|
||||
if toolchain in toolchains:
|
||||
aliases[variant].extend(target)
|
||||
env.Alias(variant_name, target)
|
||||
@@ -798,3 +904,4 @@ def do_count(target, source, env):
|
||||
print "Total unit test lines: %d" % lines
|
||||
|
||||
PhonyTargets(env, count = do_count)
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ environment:
|
||||
# At the end of each successful build we cache this directory. It must be less
|
||||
# than 100MB total compressed.
|
||||
cache:
|
||||
- 'C:\\rippled_deps'
|
||||
- "C:\\rippled_deps"
|
||||
|
||||
# This means we'll download a zip of the branch we want, rather than the full
|
||||
# history.
|
||||
|
||||
52
circle.yml
Normal file
52
circle.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
machine:
|
||||
services:
|
||||
- docker
|
||||
dependencies:
|
||||
pre:
|
||||
- sudo apt-add-repository -y 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.4 main'
|
||||
- sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
|
||||
- sudo add-apt-repository -y ppa:afrank/boost
|
||||
- wget -q -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get purge -qq libboost1.48-dev
|
||||
- sudo apt-get install -qq libboost1.57-all-dev
|
||||
- sudo apt-get install -qq clang-3.4 gcc-4.8 scons protobuf-compiler libprotobuf-dev libssl-dev exuberant-ctags
|
||||
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 99 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
|
||||
- sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.4 99 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-3.4
|
||||
- gcc --version
|
||||
- clang --version
|
||||
test:
|
||||
pre:
|
||||
- scons clang.debug
|
||||
override:
|
||||
- | # create gdb script
|
||||
echo "set env MALLOC_CHECK_=3" > script.gdb
|
||||
echo "run" >> script.gdb
|
||||
echo "backtrace full" >> script.gdb
|
||||
# gdb --help
|
||||
- cat script.gdb | gdb --ex 'set print thread-events off' --return-child-result --args build/clang.debug/rippled --unittest
|
||||
- npm install
|
||||
# Use build/(gcc|clang).debug/rippled
|
||||
- |
|
||||
echo "exports.default_server_config = {\"rippled_path\" : \"$HOME/rippled/build/clang.debug/rippled\"};" > test/config.js
|
||||
|
||||
# Run integration tests
|
||||
- npm test
|
||||
post:
|
||||
- mkdir -p build/docker/
|
||||
- cp doc/rippled-example.cfg build/clang.debug/rippled build/docker/
|
||||
- cp Builds/Docker/Dockerfile-testnet build/docker/Dockerfile
|
||||
- mv build/docker/rippled-example.cfg build/docker/rippled.cfg
|
||||
- strip build/docker/rippled
|
||||
- docker build -t ripple/rippled:$CIRCLE_SHA1 build/docker/
|
||||
- docker tag ripple/rippled:$CIRCLE_SHA1 ripple/rippled:latest
|
||||
- docker tag ripple/rippled:$CIRCLE_SHA1 ripple/rippled:$CIRCLE_BRANCH
|
||||
- docker images
|
||||
deployment:
|
||||
docker:
|
||||
branch: /.*/
|
||||
commands:
|
||||
- docker login -e $DOCKER_EMAIL -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
||||
- docker push ripple/rippled:$CIRCLE_SHA1
|
||||
- docker push ripple/rippled:$CIRCLE_BRANCH
|
||||
- docker push ripple/rippled:latest
|
||||
@@ -1,19 +1,12 @@
|
||||
VFALCO NOTE - This file appears to be unmaintained.
|
||||
A list of rippled version numbers, and the Github pull requests they contain.
|
||||
|
||||
Critical protocol changes
|
||||
-------------------------
|
||||
|
||||
Mon Apr 8 16:13:12 PDT 2013
|
||||
* The JSON field "inLedger" changing to "ledger_index"
|
||||
|
||||
Previous
|
||||
* The JSON field "metaData" changing to "meta".
|
||||
* RPC ledger will no longer take "ledger", use "ledger_hash" or "ledger_index".
|
||||
* "ledgerClose" events:
|
||||
** "hash" DEPRECATED: use "ledger_hash"
|
||||
** "seqNum" DEPRECATED: use "ledger_index"
|
||||
** "closeTime" DEPRECATED: use "close" or "close_human"
|
||||
* stream "rt_accounts" --> "accounts_proposed"
|
||||
* stream "rt_transactions" --> "transactions_proposed"
|
||||
* subscribe "username" --> "url_username"
|
||||
* subscribe "password" --> "url_password"
|
||||
0.28.0-b12: Includes pulls 836, 887, 902, 903 and 904.
|
||||
0.28.0-b13: Includes pulls 906, 912, 913, 914 and 915.
|
||||
0.28.0-b14: Includes pulls 907, 910, 922 and 923.
|
||||
0.28.0-b15: Includes pulls 832, 870, 879, 883, 911, 916, 919, 920, 924, 925 and 928. FAILED pulls 909 and 926.
|
||||
0.28.0-b16: Includes pulls 909, 926, 929, 931, 932, 935 and 934.
|
||||
0.28.0-b17: Includes pulls 927, 939, 940, 943, 944, 945 and 949.
|
||||
0.28.0-b18: Includes pulls 930, 946, 947, 948, 951, 952, 953, 954, 955, 956, 959, 960 and 962.
|
||||
0.29.0-b19: Includes pulls 967, 969 and 971.
|
||||
0.29.0-b20: Includes pulls 935, 942, 957, 958, 963, 964, 965, 966, 968, 972, 973, 974 and 975.
|
||||
0.29.0-b21: Includes pulls 970 and 976.
|
||||
|
||||
16
doc/Docker.md
Normal file
16
doc/Docker.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Rippled Docker Image
|
||||
|
||||
Rippled has a continuous deployment pipeline that turns every git commit into a
|
||||
docker image for quick testing and deployment.
|
||||
|
||||
To run the tip of the latest release via docker:
|
||||
|
||||
```$ docker run -P -v /srv/rippled/ ripple/rippled:latest```
|
||||
|
||||
To run the tip of active development:
|
||||
|
||||
```$ docker run -P -v /srv/rippled/ ripple/rippled:develop```
|
||||
|
||||
Where ```/srv/rippled``` points to a directory containing a rippled.cfg and
|
||||
database files. By default, port 5005/tcp maps to the RPC port and 51235/udp to
|
||||
the peer port.
|
||||
@@ -10,19 +10,17 @@
|
||||
#
|
||||
# 2. Peer Protocol
|
||||
#
|
||||
# 3. SMS Gateway
|
||||
# 3. Ripple Protocol
|
||||
#
|
||||
# 4. Ripple Protocol
|
||||
# 4. HTTPS Client
|
||||
#
|
||||
# 5. HTTPS Client
|
||||
# 5. Database
|
||||
#
|
||||
# 6. Database
|
||||
# 6. Diagnostics
|
||||
#
|
||||
# 7. Diagnostics
|
||||
# 7. Voting
|
||||
#
|
||||
# 8. Voting
|
||||
#
|
||||
# 9. Example Settings
|
||||
# 8. Example Settings
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
@@ -187,13 +185,21 @@
|
||||
# using HTTP's Basic Authentication headers when making outbound HTTP/S
|
||||
# requests.
|
||||
#
|
||||
# admin = no | allow
|
||||
# admin = [ IP, IP, IP, ... ]
|
||||
#
|
||||
# Controls whether or not administrative commands are allowed. These
|
||||
# commands may be issued over http, https, ws, or wss if configured
|
||||
# on the port. If unspecified, the default is to not allow
|
||||
# A comma-separated list of IP addresses.
|
||||
#
|
||||
# When set, grants administrative command access to the specified IP
|
||||
# addresses. These commands may be issued over http, https, ws, or wss
|
||||
# if configured on the port. If unspecified, the default is to not allow
|
||||
# administrative commands.
|
||||
#
|
||||
# *SECURITY WARNING*
|
||||
# 0.0.0.0 may be specified to allow access from any IP address. It must
|
||||
# be the only address specified and cannot be combined with other IPs.
|
||||
# Use of this address can compromise server security, please consider its
|
||||
# use carefully.
|
||||
#
|
||||
# admin_user = <text>
|
||||
# admin_password = <text>
|
||||
#
|
||||
@@ -233,15 +239,6 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
# [rpc_admin_allow]
|
||||
#
|
||||
# Specify a list of IP addresses allowed to have admin access. One per line.
|
||||
# If you want to test the output of non-admin commands add this section and
|
||||
# just put an ip address not under your control.
|
||||
# Defaults to 127.0.0.1.
|
||||
#
|
||||
#
|
||||
#
|
||||
# [rpc_startup]
|
||||
#
|
||||
# Specify a list of RPC commands to run at startup.
|
||||
@@ -374,12 +371,6 @@
|
||||
# When set, activates the autoconnect feature. This maintains outgoing
|
||||
# connections using PeerFinder's "Outgoing Connection Strategy."
|
||||
#
|
||||
# http_handshake = 0 | 1
|
||||
#
|
||||
# When set, outgoing peer connections will handshaking using a HTTP
|
||||
# request instead of the legacy TMHello protocol buffers message.
|
||||
# Incoming peer connections have their handshakes detected automatically.
|
||||
#
|
||||
# become_superpeer = 'never' | 'always' | 'auto'
|
||||
#
|
||||
# Controls the selection of peer roles:
|
||||
@@ -404,43 +395,7 @@
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# 3. SMS Gateway
|
||||
#
|
||||
#---------------
|
||||
#
|
||||
# If you have a certain SMS messaging provider you can configure these
|
||||
# settings to allow the rippled server instance to send an SMS text to the
|
||||
# configured gateway in response to an admin-level RPC command "sms" with
|
||||
# one parameter, 'text' containing the message to send. This allows backend
|
||||
# applications to use the rippled instance to securely notify administrators
|
||||
# of custom events or information via SMS gateway.
|
||||
#
|
||||
# When the 'sms' RPC command is issued, the configured SMS gateway will be
|
||||
# contacted via HTTPS GET at the URL indicated by sms_url. The URI formed
|
||||
# will be in this format:
|
||||
#
|
||||
# [sms_url]?from=[sms_from]&to=[sms_to]&api_key=[sms_key]&api_secret=[sms_secret]&text=['text']
|
||||
#
|
||||
# Where [...] are the corresponding values from the configuration file, and
|
||||
# ['test'] is the value of the JSON field with name 'text'.
|
||||
#
|
||||
# [sms_url]
|
||||
#
|
||||
# The URL to contact via HTTPS when sending SMS messages
|
||||
#
|
||||
# [sms_from]
|
||||
# [sms_to]
|
||||
# [sms_key]
|
||||
# [sms_secret]
|
||||
#
|
||||
# These are all strings passed directly in the URI as query parameters
|
||||
# to the provider of the SMS gateway.
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# 4. Ripple Protocol
|
||||
# 3. Ripple Protocol
|
||||
#
|
||||
#-------------------
|
||||
#
|
||||
@@ -477,17 +432,12 @@
|
||||
# need to serve clients can set this to "none". Servers that want complete
|
||||
# history can set this to "full".
|
||||
#
|
||||
# This must be less than or equal to online_delete (if online_delete is used)
|
||||
#
|
||||
# The default is: 256
|
||||
#
|
||||
#
|
||||
#
|
||||
# [ledger_history_index]
|
||||
#
|
||||
# If set to greater than 0, the index number of the earliest ledger to
|
||||
# acquire.
|
||||
#
|
||||
#
|
||||
#
|
||||
# [fetch_depth]
|
||||
#
|
||||
# The number of past ledgers to serve to other peers that request historical
|
||||
@@ -578,7 +528,7 @@
|
||||
# [path_search_old]
|
||||
#
|
||||
# For clients that use the legacy path finding interfaces, the search
|
||||
# agressivness to use. The default is 7.
|
||||
# aggressiveness to use. The default is 7.
|
||||
#
|
||||
#
|
||||
#
|
||||
@@ -591,14 +541,14 @@
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# 5. HTTPS Client
|
||||
# 4. HTTPS Client
|
||||
#
|
||||
#----------------
|
||||
#
|
||||
# The rippled server instance uses HTTPS GET requests in a variety of
|
||||
# circumstances, including but not limited to the SMS Messaging Gateway
|
||||
# feature and also for contacting trusted domains to fetch information
|
||||
# such as mapping an email address to a Ripple Payment Network address.
|
||||
# circumstances, including but not limited to contacting trusted domains to
|
||||
# fetch information such as mapping an email address to a Ripple Payment
|
||||
# Network address.
|
||||
#
|
||||
# [ssl_verify]
|
||||
#
|
||||
@@ -633,7 +583,7 @@
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# 6. Database
|
||||
# 5. Database
|
||||
#
|
||||
#------------
|
||||
#
|
||||
@@ -666,16 +616,13 @@
|
||||
# ...
|
||||
#
|
||||
# Examples:
|
||||
# type=HyperLevelDB
|
||||
# path=db/hyperldb
|
||||
# compression=0
|
||||
# type=rocksdb
|
||||
# path=db/rocksdb
|
||||
#
|
||||
# Choices for 'type' (not case-sensitive)
|
||||
# RocksDB Use Facebook's RocksDB database (preferred)
|
||||
# NuDB Use Ripple Labs' NuDB (Windows preferred)
|
||||
# HyperLevelDB (Deprecated)
|
||||
# SQLite (Deprecated)
|
||||
# LevelDB (Deprecated)
|
||||
# none (No backend)
|
||||
#
|
||||
# Required keys:
|
||||
@@ -708,13 +655,14 @@
|
||||
# There are 4 book-keeping SQLite database that the server creates and
|
||||
# maintains. If you omit this configuration setting, it will default to
|
||||
# creating a directory called "db" located in the same place as your
|
||||
# rippled.cfg file.
|
||||
# rippled.cfg file. Partial pathnames will be considered relative to
|
||||
# the location of the rippled executable.
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# 7. Diagnostics
|
||||
# 6. Diagnostics
|
||||
#
|
||||
#---------------
|
||||
#
|
||||
@@ -735,10 +683,10 @@
|
||||
#
|
||||
# [insight]
|
||||
#
|
||||
# Configuration parameters for the Beast.Insight stats collection module.
|
||||
# Configuration parameters for the Beast. Insight stats collection module.
|
||||
#
|
||||
# Insight is a module that collects information from the areas of rippled
|
||||
# that have instrumentation. The configuration paramters control where the
|
||||
# that have instrumentation. The configuration parameters control where the
|
||||
# collection metrics are sent. The parameters are expressed as key = value
|
||||
# pairs with no white space. The main parameter is the choice of server:
|
||||
#
|
||||
@@ -770,7 +718,7 @@
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# 8. Voting
|
||||
# 7. Voting
|
||||
#
|
||||
#----------
|
||||
#
|
||||
@@ -797,7 +745,7 @@
|
||||
#
|
||||
# account_reserve = <drops>
|
||||
#
|
||||
# The account reserve requirement specified in drops. The portion of an
|
||||
# The account reserve requirement is specified in drops. The portion of an
|
||||
# account's XRP balance that is at or below the reserve may only be
|
||||
# spent on transaction fees, and not transferred out of the account.
|
||||
#
|
||||
@@ -821,11 +769,11 @@
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# 9. Example Settings
|
||||
# 8. Example Settings
|
||||
#
|
||||
#--------------------
|
||||
#
|
||||
# Administrators can use these values as a starting poing for configuring
|
||||
# Administrators can use these values as a starting point for configuring
|
||||
# their instance of rippled, but each value should be checked to make sure
|
||||
# it meets the business requirements for the organization.
|
||||
#
|
||||
@@ -878,7 +826,7 @@ port_wss_admin
|
||||
[port_rpc]
|
||||
port = 5005
|
||||
ip = 127.0.0.1
|
||||
admin = allow
|
||||
admin = 127.0.0.1
|
||||
protocol = https
|
||||
|
||||
[port_peer]
|
||||
@@ -889,7 +837,7 @@ protocol = peer
|
||||
[port_wss_admin]
|
||||
port = 6006
|
||||
ip = 127.0.0.1
|
||||
admin = allow
|
||||
admin = 127.0.0.1
|
||||
protocol = wss
|
||||
|
||||
#[port_ws_public]
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 44 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 43 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 71 KiB |
18
package.json
18
package.json
@@ -2,33 +2,29 @@
|
||||
"name": "rippled",
|
||||
"version": "0.0.1",
|
||||
"description": "Rippled Server",
|
||||
|
||||
"private": true,
|
||||
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
|
||||
"dependencies": {
|
||||
"ripple-lib": "0.8.2",
|
||||
"async": "~0.2.9",
|
||||
"deep-equal": "0.0.0",
|
||||
"extend": "~1.2.0",
|
||||
"simple-jsonrpc": "~0.0.2",
|
||||
"deep-equal": "0.0.0"
|
||||
"request": "^2.47.0",
|
||||
"ripple-lib": "0.10.0",
|
||||
"simple-jsonrpc": "~0.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coffee-script": "~1.6.3",
|
||||
"mocha": "~1.13.0"
|
||||
"assert-diff": "^1.0.1",
|
||||
"coffee-script": "^1.8.0",
|
||||
"mocha": "^2.1.0"
|
||||
},
|
||||
|
||||
"scripts": {
|
||||
"test": "mocha test/websocket-test.js test/server-test.js test/*-test.{js,coffee}"
|
||||
},
|
||||
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/ripple/rippled.git"
|
||||
},
|
||||
|
||||
"readmeFilename": "README.md"
|
||||
}
|
||||
|
||||
@@ -59,8 +59,6 @@
|
||||
|
||||
/** Config: BEAST_CHECK_MEMORY_LEAKS
|
||||
Enables a memory-leak check for certain objects when the app terminates.
|
||||
See the LeakChecked class for more details about enabling leak checking for
|
||||
specific classes.
|
||||
*/
|
||||
#ifndef BEAST_CHECK_MEMORY_LEAKS
|
||||
//#define BEAST_CHECK_MEMORY_LEAKS 0
|
||||
@@ -182,13 +180,6 @@
|
||||
#define RIPPLE_PROPOSE_AMENDMENTS 0
|
||||
#endif
|
||||
|
||||
/** Config: RIPPLE_ENABLE_AUTOBRIDGING
|
||||
This determines whether ripple implements offer autobridging via XRP.
|
||||
*/
|
||||
#ifndef RIPPLE_ENABLE_AUTOBRIDGING
|
||||
#define RIPPLE_ENABLE_AUTOBRIDGING 0
|
||||
#endif
|
||||
|
||||
/** Config: RIPPLE_SINGLE_IO_SERVICE_THREAD
|
||||
When set, restricts the number of threads calling io_service::run to one.
|
||||
This is useful when debugging.
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#endif
|
||||
|
||||
#include <beast/asio/impl/IPAddressConversion.cpp>
|
||||
#include <beast/asio/impl/error.cpp>
|
||||
#include <beast/asio/tests/bind_handler.test.cpp>
|
||||
#include <beast/asio/tests/streambuf.test.cpp>
|
||||
#include <beast/asio/tests/error_test.cpp>
|
||||
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_ASIO_SSL_H_INCLUDED
|
||||
#define BEAST_ASIO_SSL_H_INCLUDED
|
||||
#ifndef BEAST_ASIO_ERROR_H_INCLUDED
|
||||
#define BEAST_ASIO_ERROR_H_INCLUDED
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/ssl/error.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace asio {
|
||||
@@ -32,8 +32,12 @@ bool
|
||||
is_short_read (boost::system::error_code const& ec)
|
||||
{
|
||||
return (ec.category() == boost::asio::error::get_ssl_category())
|
||||
&& (ERR_GET_REASON(ec.value()) == SSL_R_SHORT_READ);
|
||||
&& (ERR_GET_REASON(ec.value()) == SSL_R_SHORT_READ);
|
||||
}
|
||||
|
||||
/** Returns a human readable message if the error code is SSL related. */
|
||||
std::string
|
||||
asio_message(boost::system::error_code const& ec);
|
||||
|
||||
}
|
||||
}
|
||||
59
src/beast/beast/asio/impl/error.cpp
Normal file
59
src/beast/beast/asio/impl/error.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/asio/error.h>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace asio {
|
||||
|
||||
// This buffer must be at least 120 bytes, most examples use 256.
|
||||
// https://www.openssl.org/docs/crypto/ERR_error_string.html
|
||||
static std::uint32_t const errorBufferSize (256);
|
||||
|
||||
std::string
|
||||
asio_message (boost::system::error_code const& ec)
|
||||
{
|
||||
std::string error;
|
||||
|
||||
if (ec.category () == boost::asio::error::get_ssl_category ())
|
||||
{
|
||||
error = " ("
|
||||
+ boost::lexical_cast<std::string> (ERR_GET_LIB (ec.value ()))
|
||||
+ ","
|
||||
+ boost::lexical_cast<std::string> (ERR_GET_FUNC (ec.value ()))
|
||||
+ ","
|
||||
+ boost::lexical_cast<std::string> (ERR_GET_REASON (ec.value ()))
|
||||
+ ") ";
|
||||
|
||||
//
|
||||
char buf[errorBufferSize];
|
||||
::ERR_error_string_n (ec.value (), buf, errorBufferSize);
|
||||
error += buf;
|
||||
}
|
||||
else
|
||||
{
|
||||
error = ec.message ();
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -17,30 +17,28 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_SQLITE_H_INCLUDED
|
||||
#define BEAST_SQLITE_H_INCLUDED
|
||||
#include <beast/asio/error.h>
|
||||
#include <beast/unit_test/suite.h>
|
||||
#include <string>
|
||||
|
||||
/** A self-contained, serverless, zero configuration, transactional SQL engine.
|
||||
namespace beast {
|
||||
namespace asio {
|
||||
|
||||
This external module provides the SQLite embedded database library.
|
||||
class error_test : public unit_test::suite
|
||||
{
|
||||
public:
|
||||
void run ()
|
||||
{
|
||||
{
|
||||
boost::system::error_code ec = boost::system::error_code (335544539,
|
||||
boost::asio::error::get_ssl_category ());
|
||||
std::string const s = beast::asio::asio_message (ec);
|
||||
expect(s == " (20,0,219) error:140000DB:SSL routines:SSL routines:short read");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
SQLite is public domain software, visit http://sqlite.org
|
||||
*/
|
||||
BEAST_DEFINE_TESTSUITE(error,asio,beast);
|
||||
|
||||
#include <beast/config/PlatformConfig.h>
|
||||
|
||||
#if BEAST_IOS || BEAST_MAC
|
||||
# define BEAST_HAVE_NATIVE_SQLITE 1
|
||||
#else
|
||||
# define BEAST_HAVE_NATIVE_SQLITE 0
|
||||
#endif
|
||||
|
||||
#ifndef BEAST_SQLITE_CPP_INCLUDED
|
||||
# if BEAST_USE_NATIVE_SQLITE && BEAST_HAVE_NATIVE_SQLITE
|
||||
#include <sqlite3.h>
|
||||
# else
|
||||
#include <beast/module/sqlite/sqlite/sqlite3.h> // Amalgamated
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CHRONO_UTIL_H_INCLUDED
|
||||
#define BEAST_CHRONO_UTIL_H_INCLUDED
|
||||
#ifndef BEAST_CHRONO_CHRONO_UTIL_H_INCLUDED
|
||||
#define BEAST_CHRONO_CHRONO_UTIL_H_INCLUDED
|
||||
|
||||
// From Howard Hinnant
|
||||
// http://home.roadrunner.com/~hinnant/duration_io/chrono_util.html
|
||||
|
||||
@@ -88,6 +88,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(abstract_clock,chrono,beast);
|
||||
BEAST_DEFINE_TESTSUITE_MANUAL(abstract_clock,chrono,beast);
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
// Ideas from boost
|
||||
|
||||
// Intel
|
||||
#ifndef BEAST_CONFIG_SELECTCOMPILERCONFIG_H_INCLUDED
|
||||
#define BEAST_CONFIG_SELECTCOMPILERCONFIG_H_INCLUDED
|
||||
|
||||
#if defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)
|
||||
#define BEAST_COMPILER_CONFIG "config/compiler/Intel.h"
|
||||
|
||||
@@ -42,3 +45,4 @@
|
||||
#error "Unsupported compiler."
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
// Ideas from boost
|
||||
|
||||
// Android, which must be manually set by defining BEAST_ANDROID
|
||||
#ifndef BEAST_CONFIG_SELECTPLATFORMCONFIG_H_INCLUDED
|
||||
#define BEAST_CONFIG_SELECTPLATFORMCONFIG_H_INCLUDED
|
||||
|
||||
#if defined(BEAST_ANDROID)
|
||||
#define BEAST_PLATFORM_CONFIG "config/platform/Android.h"
|
||||
|
||||
@@ -42,3 +45,4 @@
|
||||
#else
|
||||
#error "Unsupported platform."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -19,4 +19,8 @@
|
||||
|
||||
// Microsoft Visual C++ compiler configuration
|
||||
|
||||
#ifndef BEAST_CONFIG_COMPILER_VISUALC_H_INCLUDED
|
||||
#define BEAST_CONFIG_COMPILER_VISUALC_H_INCLUDED
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
#endif
|
||||
|
||||
@@ -19,8 +19,12 @@
|
||||
|
||||
// Android platform configuration
|
||||
|
||||
#ifndef BEAST_CONFIG_PLATFORM_ANDROID_H_INCLUDED
|
||||
#define BEAST_CONFIG_PLATFORM_ANDROID_H_INCLUDED
|
||||
|
||||
#ifdef BEAST_ANDROID
|
||||
#undef BEAST_ANDROID
|
||||
#endif
|
||||
#define BEAST_ANDROID 1
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,4 +22,3 @@
|
||||
#endif
|
||||
|
||||
#include <beast/container/tests/aged_associative_container.test.cpp>
|
||||
#include <beast/container/tests/buffer_view.test.cpp>
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CYCLIC_ITERATOR_H_INCLUDED
|
||||
#define BEAST_CYCLIC_ITERATOR_H_INCLUDED
|
||||
#ifndef BEAST_CONTAINER_CYCLIC_ITERATOR_H_INCLUDED
|
||||
#define BEAST_CONTAINER_CYCLIC_ITERATOR_H_INCLUDED
|
||||
|
||||
#include <iterator>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CONTAINER_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED
|
||||
#define BEAST_CONTAINER_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED
|
||||
#ifndef BEAST_CONTAINER_DETAIL_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED
|
||||
#define BEAST_CONTAINER_DETAIL_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CONTAINER_AGED_CONTAINER_ITERATOR_H_INCLUDED
|
||||
#define BEAST_CONTAINER_AGED_CONTAINER_ITERATOR_H_INCLUDED
|
||||
#ifndef BEAST_CONTAINER_DETAIL_AGED_CONTAINER_ITERATOR_H_INCLUDED
|
||||
#define BEAST_CONTAINER_DETAIL_AGED_CONTAINER_ITERATOR_H_INCLUDED
|
||||
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CONTAINER_AGED_ORDERED_CONTAINER_H_INCLUDED
|
||||
#define BEAST_CONTAINER_AGED_ORDERED_CONTAINER_H_INCLUDED
|
||||
#ifndef BEAST_CONTAINER_DETAIL_AGED_ORDERED_CONTAINER_H_INCLUDED
|
||||
#define BEAST_CONTAINER_DETAIL_AGED_ORDERED_CONTAINER_H_INCLUDED
|
||||
|
||||
#include <beast/container/detail/aged_container_iterator.h>
|
||||
#include <beast/container/detail/aged_associative_container.h>
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CONTAINER_AGED_UNORDERED_CONTAINER_H_INCLUDED
|
||||
#define BEAST_CONTAINER_AGED_UNORDERED_CONTAINER_H_INCLUDED
|
||||
#ifndef BEAST_CONTAINER_DETAIL_AGED_UNORDERED_CONTAINER_H_INCLUDED
|
||||
#define BEAST_CONTAINER_DETAIL_AGED_UNORDERED_CONTAINER_H_INCLUDED
|
||||
|
||||
#include <beast/container/detail/aged_container_iterator.h>
|
||||
#include <beast/container/detail/aged_associative_container.h>
|
||||
|
||||
@@ -387,10 +387,10 @@ public:
|
||||
|
||||
template <class Cont>
|
||||
static
|
||||
std::list <typename Cont::value_type>
|
||||
std::vector <typename Cont::value_type>
|
||||
make_list (Cont const& c)
|
||||
{
|
||||
return std::list <typename Cont::value_type> (
|
||||
return std::vector <typename Cont::value_type> (
|
||||
c.begin(), c.end());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,320 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/unit_test/suite.h>
|
||||
|
||||
#include <beast/container/buffer_view.h>
|
||||
|
||||
#include <beast/cxx14/algorithm.h> // <algorithm>
|
||||
|
||||
namespace beast {
|
||||
|
||||
class buffer_view_test : public unit_test::suite
|
||||
{
|
||||
public:
|
||||
// Returns `true` if the iterator distance matches the size
|
||||
template <class FwdIt, class Size>
|
||||
static bool eq_dist (FwdIt first, FwdIt last, Size size)
|
||||
{
|
||||
auto const dist (std::distance (first, last));
|
||||
|
||||
static_assert (std::is_signed <decltype (dist)>::value,
|
||||
"dist must be signed");
|
||||
|
||||
if (dist < 0)
|
||||
return false;
|
||||
|
||||
return static_cast <Size> (dist) == size;
|
||||
}
|
||||
|
||||
// Check the contents of a buffer_view against the container
|
||||
template <class C, class T>
|
||||
void check (C const& c, buffer_view <T> v)
|
||||
{
|
||||
expect (! v.empty() || c.empty());
|
||||
expect (v.size() == c.size());
|
||||
expect (v.max_size() == v.size());
|
||||
expect (v.capacity() == v.size());
|
||||
|
||||
expect (eq_dist (v.begin(), v.end(), v.size()));
|
||||
expect (eq_dist (v.cbegin(), v.cend(), v.size()));
|
||||
expect (eq_dist (v.rbegin(), v.rend(), v.size()));
|
||||
expect (eq_dist (v.crbegin(), v.crend(), v.size()));
|
||||
|
||||
expect (std::equal (
|
||||
c.cbegin(), c.cend(), v.cbegin(), v.cend()));
|
||||
|
||||
expect (std::equal (
|
||||
c.crbegin(), c.crend(), v.crbegin(), v.crend()));
|
||||
|
||||
if (v.size() == c.size())
|
||||
{
|
||||
if (! v.empty())
|
||||
{
|
||||
expect (v.front() == c.front());
|
||||
expect (v.back() == c.back());
|
||||
}
|
||||
|
||||
for (std::size_t i (0); i < v.size(); ++i)
|
||||
expect (v[i] == c[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// Call at() with an invalid index
|
||||
template <class V>
|
||||
void checkBadIndex (V& v,
|
||||
std::enable_if_t <
|
||||
std::is_const <typename V::value_type>::value>* = 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
v.at(0);
|
||||
fail();
|
||||
}
|
||||
catch (std::out_of_range e)
|
||||
{
|
||||
pass();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
fail();
|
||||
}
|
||||
}
|
||||
|
||||
// Call at() with an invalid index
|
||||
template <class V>
|
||||
void checkBadIndex (V& v,
|
||||
std::enable_if_t <
|
||||
! std::is_const <typename V::value_type>::value>* = 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
v.at(0);
|
||||
fail();
|
||||
}
|
||||
catch (std::out_of_range e)
|
||||
{
|
||||
pass();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
fail();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
v.at(0) = 1;
|
||||
fail();
|
||||
}
|
||||
catch (std::out_of_range e)
|
||||
{
|
||||
pass();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
fail();
|
||||
}
|
||||
}
|
||||
|
||||
// Checks invariants for an empty buffer_view
|
||||
template <class V>
|
||||
void checkEmpty (V& v)
|
||||
{
|
||||
expect (v.empty());
|
||||
expect (v.size() == 0);
|
||||
expect (v.max_size() == v.size());
|
||||
expect (v.capacity() == v.size());
|
||||
expect (v.begin() == v.end());
|
||||
expect (v.cbegin() == v.cend());
|
||||
expect (v.begin() == v.cend());
|
||||
expect (v.rbegin() == v.rend());
|
||||
expect (v.crbegin() == v.rend());
|
||||
|
||||
checkBadIndex (v);
|
||||
}
|
||||
|
||||
// Test empty containers
|
||||
void testEmpty()
|
||||
{
|
||||
testcase ("empty");
|
||||
|
||||
buffer_view <char> v1;
|
||||
checkEmpty (v1);
|
||||
|
||||
buffer_view <char> v2;
|
||||
swap (v1, v2);
|
||||
checkEmpty (v1);
|
||||
checkEmpty (v2);
|
||||
|
||||
buffer_view <char const> v3 (v2);
|
||||
checkEmpty (v3);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// Construct const views from a container
|
||||
template <class C>
|
||||
void testConstructConst (C const& c)
|
||||
{
|
||||
typedef buffer_view <std::add_const_t <
|
||||
typename C::value_type>> V;
|
||||
|
||||
{
|
||||
// construct from container
|
||||
V v (c);
|
||||
check (c, v);
|
||||
|
||||
// construct from buffer_view
|
||||
V v2 (v);
|
||||
check (c, v2);
|
||||
}
|
||||
|
||||
if (! c.empty())
|
||||
{
|
||||
{
|
||||
// construct from const pointer range
|
||||
V v (&c.front(), &c.back()+1);
|
||||
check (c, v);
|
||||
|
||||
// construct from pointer and size
|
||||
V v2 (&c.front(), c.size());
|
||||
check (v, v2);
|
||||
}
|
||||
|
||||
{
|
||||
// construct from non const pointer range
|
||||
C cp (c);
|
||||
V v (&cp.front(), &cp.back()+1);
|
||||
check (cp, v);
|
||||
|
||||
// construct from pointer and size
|
||||
V v2 (&cp.front(), cp.size());
|
||||
check (v, v2);
|
||||
|
||||
// construct from data and size
|
||||
V v3 (v2.data(), v2.size());
|
||||
check (c, v3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Construct view from a container
|
||||
template <class C>
|
||||
void testConstruct (C const& c)
|
||||
{
|
||||
static_assert (! std::is_const <typename C::value_type>::value,
|
||||
"Container value_type cannot be const");
|
||||
|
||||
testConstructConst (c);
|
||||
|
||||
typedef buffer_view <typename C::value_type> V;
|
||||
|
||||
C cp (c);
|
||||
V v (cp);
|
||||
check (cp, v);
|
||||
|
||||
std::reverse (v.begin(), v.end());
|
||||
check (cp, v);
|
||||
|
||||
expect (std::equal (v.rbegin(), v.rend(),
|
||||
c.begin(), c.end()));
|
||||
}
|
||||
|
||||
void testConstruct()
|
||||
{
|
||||
testcase ("std::vector <char>");
|
||||
testConstruct (
|
||||
std::vector <char> ({'h', 'e', 'l', 'l', 'o'}));
|
||||
|
||||
testcase ("std::string <char>");
|
||||
testConstruct (
|
||||
std::basic_string <char> ("hello"));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void testCoerce()
|
||||
{
|
||||
testcase ("coerce");
|
||||
|
||||
std::string const s ("hello");
|
||||
const_buffer_view <unsigned char> v (s);
|
||||
|
||||
pass();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void testAssign()
|
||||
{
|
||||
testcase ("testAssign");
|
||||
std::vector <int> v1({1, 2, 3});
|
||||
buffer_view<int> r1(v1);
|
||||
std::vector <int> v2({4, 5, 6, 7});
|
||||
buffer_view<int> r2(v2);
|
||||
r1 = r2;
|
||||
expect (std::equal (r1.begin(), r1.end(), v2.begin(), v2.end()));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
static_assert (std::is_constructible <buffer_view <int>,
|
||||
std::vector <int>&>::value, "");
|
||||
|
||||
static_assert (!std::is_constructible <buffer_view <int>,
|
||||
std::vector <int> const&>::value, "");
|
||||
|
||||
static_assert (std::is_constructible <buffer_view <int const>,
|
||||
std::vector <int>&>::value, "");
|
||||
|
||||
static_assert (std::is_constructible <buffer_view <int const>,
|
||||
std::vector <int> const&>::value, "");
|
||||
|
||||
static_assert (std::is_nothrow_default_constructible <
|
||||
buffer_view <int>>::value, "");
|
||||
|
||||
static_assert (std::is_nothrow_destructible <
|
||||
buffer_view <int>>::value, "");
|
||||
|
||||
static_assert (std::is_nothrow_copy_constructible <
|
||||
buffer_view <int>>::value, "");
|
||||
|
||||
static_assert (std::is_nothrow_copy_assignable <
|
||||
buffer_view<int>>::value, "");
|
||||
|
||||
static_assert (std::is_nothrow_move_constructible <
|
||||
buffer_view <int>>::value, "");
|
||||
|
||||
static_assert (std::is_nothrow_move_assignable <
|
||||
buffer_view <int>>::value, "");
|
||||
|
||||
void run()
|
||||
{
|
||||
testEmpty();
|
||||
testConstruct();
|
||||
testCoerce();
|
||||
testAssign();
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(buffer_view,container,beast);
|
||||
|
||||
}
|
||||
@@ -32,8 +32,8 @@
|
||||
* $Id: sha2.h,v 1.1 2001/11/08 00:02:01 adg Exp adg $
|
||||
*/
|
||||
|
||||
#ifndef __SHA2_H__
|
||||
#define __SHA2_H__
|
||||
#ifndef BEAST_CRYPTO_SHA2_SHA2_H_INCLUDED
|
||||
#define BEAST_CRYPTO_SHA2_SHA2_H_INCLUDED
|
||||
|
||||
//#ifdef __cplusplus
|
||||
//extern "C" {
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
// slower than MD5.
|
||||
//
|
||||
|
||||
#ifndef BEAST_SPOOKYV2_H_INCLUDED
|
||||
#define BEAST_SPOOKYV2_H_INCLUDED
|
||||
#ifndef BEAST_HASH_SPOOKYV2_H_INCLUDED
|
||||
#define BEAST_HASH_SPOOKYV2_H_INCLUDED
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ It depends on successfully passing SMHasher test set.
|
||||
10 is a perfect score.
|
||||
*/
|
||||
|
||||
#ifndef BEAST_CONTAINER_XXHASH_H_INCLUDED
|
||||
#define BEAST_CONTAINER_XXHASH_H_INCLUDED
|
||||
#ifndef BEAST_HASH_XXHASH_H_INCLUDED
|
||||
#define BEAST_HASH_XXHASH_H_INCLUDED
|
||||
|
||||
/*****************************
|
||||
Includes
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CONTAINER_TESTS_HASH_METRICS_H_INCLUDED
|
||||
#define BEAST_CONTAINER_TESTS_HASH_METRICS_H_INCLUDED
|
||||
#ifndef BEAST_HASH_HASH_METRICS_H_INCLUDED
|
||||
#define BEAST_HASH_HASH_METRICS_H_INCLUDED
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_HTTP_HEADER_TRAITS_H_INCLUDED
|
||||
#define BEAST_HTTP_HEADER_TRAITS_H_INCLUDED
|
||||
#ifndef BEAST_HTTP_DETAIL_HEADER_TRAITS_H_INCLUDED
|
||||
#define BEAST_HTTP_DETAIL_HEADER_TRAITS_H_INCLUDED
|
||||
|
||||
#include <beast/utility/ci_char_traits.h>
|
||||
|
||||
|
||||
@@ -18,8 +18,9 @@
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef http_parser_h
|
||||
#define http_parser_h
|
||||
#ifndef BEAST_HTTP_HTTP_PARSER_HTTP_PARSER_H_INCLUDED
|
||||
#define BEAST_HTTP_HTTP_PARSER_HTTP_PARSER_H_INCLUDED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -134,7 +135,7 @@ enum flags
|
||||
|
||||
|
||||
/* Map for errno-related constants
|
||||
*
|
||||
*
|
||||
* The provided argument should be a macro that takes 2 arguments.
|
||||
*/
|
||||
#define HTTP_ERRNO_MAP(XX) \
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_ASIO_ASYNCOBJECT_H_INCLUDED
|
||||
#define BEAST_ASIO_ASYNCOBJECT_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_ASIO_ASYNCOBJECT_H_INCLUDED
|
||||
#define BEAST_MODULE_ASIO_ASYNCOBJECT_H_INCLUDED
|
||||
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_ASIO_SYSTEM_BOOSTINCLUDES_H_INCLUDED
|
||||
#define BEAST_ASIO_SYSTEM_BOOSTINCLUDES_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_ASIO_BOOSTINCLUDES_H_INCLUDED
|
||||
#define BEAST_MODULE_ASIO_BOOSTINCLUDES_H_INCLUDED
|
||||
|
||||
// Make sure we take care of fixing boost::bind oddities first.
|
||||
#if !defined(BEAST_CORE_H_INCLUDED)
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_ASIO_HTTPFIELD_H_INCLUDED
|
||||
#define BEAST_ASIO_HTTPFIELD_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_ASIO_HTTPFIELD_H_INCLUDED
|
||||
#define BEAST_MODULE_ASIO_HTTPFIELD_H_INCLUDED
|
||||
|
||||
#include <beast/strings/String.h>
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_ASIO_HTTPHEADERS_H_INCLUDED
|
||||
#define BEAST_ASIO_HTTPHEADERS_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_ASIO_HTTPHEADERS_H_INCLUDED
|
||||
#define BEAST_MODULE_ASIO_HTTPHEADERS_H_INCLUDED
|
||||
|
||||
#include <beast/module/asio/HTTPField.h>
|
||||
#include <beast/module/core/text/StringPairArray.h>
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_ASIO_HTTPMESSAGE_H_INCLUDED
|
||||
#define BEAST_ASIO_HTTPMESSAGE_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_ASIO_HTTPMESSAGE_H_INCLUDED
|
||||
#define BEAST_MODULE_ASIO_HTTPMESSAGE_H_INCLUDED
|
||||
|
||||
#include <beast/module/asio/HTTPHeaders.h>
|
||||
#include <beast/module/asio/HTTPVersion.h>
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_ASIO_HTTPPARSER_H_INCLUDED
|
||||
#define BEAST_ASIO_HTTPPARSER_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_ASIO_HTTPPARSER_H_INCLUDED
|
||||
#define BEAST_MODULE_ASIO_HTTPPARSER_H_INCLUDED
|
||||
|
||||
#include <beast/module/asio/HTTPRequest.h>
|
||||
#include <beast/module/asio/HTTPResponse.h>
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_HTTPPARSERIMPL_H_INCLUDED
|
||||
#define BEAST_HTTPPARSERIMPL_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_ASIO_HTTPPARSERIMPL_H_INCLUDED
|
||||
#define BEAST_MODULE_ASIO_HTTPPARSERIMPL_H_INCLUDED
|
||||
|
||||
#include <beast/http/impl/joyent_parser.h>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_ASIO_HTTPREQUEST_H_INCLUDED
|
||||
#define BEAST_ASIO_HTTPREQUEST_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_ASIO_HTTPREQUEST_H_INCLUDED
|
||||
#define BEAST_MODULE_ASIO_HTTPREQUEST_H_INCLUDED
|
||||
|
||||
#include <beast/module/asio/HTTPMessage.h>
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_HTTP_REQUESTPARSER_H_INCLUDED
|
||||
#define BEAST_HTTP_REQUESTPARSER_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_ASIO_HTTPREQUESTPARSER_H_INCLUDED
|
||||
#define BEAST_MODULE_ASIO_HTTPREQUESTPARSER_H_INCLUDED
|
||||
|
||||
#include <beast/module/asio/HTTPParser.h>
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_ASIO_HTTPRESPONSE_H_INCLUDED
|
||||
#define BEAST_ASIO_HTTPRESPONSE_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_ASIO_HTTPRESPONSE_H_INCLUDED
|
||||
#define BEAST_MODULE_ASIO_HTTPRESPONSE_H_INCLUDED
|
||||
|
||||
#include <beast/module/asio/HTTPMessage.h>
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_HTTP_RESPONSEPARSER_H_INCLUDED
|
||||
#define BEAST_HTTP_RESPONSEPARSER_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_ASIO_HTTPRESPONSEPARSER_H_INCLUDED
|
||||
#define BEAST_MODULE_ASIO_HTTPRESPONSEPARSER_H_INCLUDED
|
||||
|
||||
#include <beast/module/asio/HTTPParser.h>
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_ASIO_HTTPVERSION_H_INCLUDED
|
||||
#define BEAST_ASIO_HTTPVERSION_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_ASIO_HTTPVERSION_H_INCLUDED
|
||||
#define BEAST_MODULE_ASIO_HTTPVERSION_H_INCLUDED
|
||||
|
||||
namespace beast {
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_ASIO_SYSTEM_OPENSSLINCLUDES_H_INCLUDED
|
||||
#define BEAST_ASIO_SYSTEM_OPENSSLINCLUDES_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_ASIO_OPENSSLINCLUDES_H_INCLUDED
|
||||
#define BEAST_MODULE_ASIO_OPENSSLINCLUDES_H_INCLUDED
|
||||
|
||||
#define OPENSSL_THREAD_DEFINES
|
||||
#include <openssl/opensslconf.h>
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_ARRAY_H_INCLUDED
|
||||
#define BEAST_ARRAY_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_CONTAINERS_ARRAY_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_CONTAINERS_ARRAY_H_INCLUDED
|
||||
|
||||
#include <beast/module/core/containers/ArrayAllocationBase.h>
|
||||
#include <beast/module/core/containers/ElementComparator.h>
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_ARRAYALLOCATIONBASE_H_INCLUDED
|
||||
#define BEAST_ARRAYALLOCATIONBASE_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_CONTAINERS_ARRAYALLOCATIONBASE_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_CONTAINERS_ARRAYALLOCATIONBASE_H_INCLUDED
|
||||
|
||||
#include <beast/HeapBlock.h>
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_ELEMENTCOMPARATOR_H_INCLUDED
|
||||
#define BEAST_ELEMENTCOMPARATOR_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_CONTAINERS_ELEMENTCOMPARATOR_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_CONTAINERS_ELEMENTCOMPARATOR_H_INCLUDED
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CORE_H_INCLUDED
|
||||
#define BEAST_CORE_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_CORE_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_CORE_H_INCLUDED
|
||||
|
||||
// TargetPlatform.h should not use anything from BeastConfig.h
|
||||
#include <beast/Config.h>
|
||||
@@ -52,9 +52,7 @@
|
||||
#include <beast/utility/Debug.h>
|
||||
#include <beast/utility/Error.h>
|
||||
#include <beast/utility/Journal.h>
|
||||
#include <beast/utility/LeakChecked.h>
|
||||
#include <beast/utility/PropertyStream.h>
|
||||
#include <beast/utility/StaticObject.h>
|
||||
|
||||
#include <beast/module/core/system/StandardIncludes.h>
|
||||
|
||||
@@ -144,7 +142,6 @@ class FileOutputStream;
|
||||
#include <beast/module/core/streams/FileInputSource.h>
|
||||
#include <beast/module/core/streams/OutputStream.h>
|
||||
#include <beast/module/core/files/FileOutputStream.h>
|
||||
#include <beast/module/core/memory/SharedSingleton.h>
|
||||
#include <beast/module/core/streams/MemoryOutputStream.h>
|
||||
|
||||
#include <beast/module/core/system/SystemStats.h>
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CORE_FATALERROR_H_INCLUDED
|
||||
#define BEAST_CORE_FATALERROR_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_DIAGNOSTIC_FATALERROR_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_DIAGNOSTIC_FATALERROR_H_INCLUDED
|
||||
|
||||
#include <beast/strings/String.h>
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CORE_DIAGNOSTIC_MEASUREFUNCTIONCALLTIME_H_INCLUDED
|
||||
#define BEAST_CORE_DIAGNOSTIC_MEASUREFUNCTIONCALLTIME_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_DIAGNOSTIC_MEASUREFUNCTIONCALLTIME_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_DIAGNOSTIC_MEASUREFUNCTIONCALLTIME_H_INCLUDED
|
||||
|
||||
namespace beast
|
||||
{
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_SEMANTICVERSION_H_INCLUDED
|
||||
#define BEAST_SEMANTICVERSION_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_DIAGNOSTIC_SEMANTICVERSION_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_DIAGNOSTIC_SEMANTICVERSION_H_INCLUDED
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_UNITTESTUTILITIES_H_INCLUDED
|
||||
#define BEAST_UNITTESTUTILITIES_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_DIAGNOSTIC_UNITTESTUTILITIES_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_DIAGNOSTIC_UNITTESTUTILITIES_H_INCLUDED
|
||||
|
||||
#include <beast/module/core/files/File.h>
|
||||
#include <beast/module/core/maths/Random.h>
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_DIRECTORYITERATOR_H_INCLUDED
|
||||
#define BEAST_DIRECTORYITERATOR_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_FILES_DIRECTORYITERATOR_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_FILES_DIRECTORYITERATOR_H_INCLUDED
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace beast {
|
||||
|
||||
It can also guess how far it's got using a wildly inaccurate algorithm.
|
||||
*/
|
||||
class DirectoryIterator : LeakChecked <DirectoryIterator>
|
||||
class DirectoryIterator
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
class NativeIterator : LeakChecked <NativeIterator>
|
||||
class NativeIterator
|
||||
{
|
||||
public:
|
||||
NativeIterator (const File& directory, const String& wildCard);
|
||||
|
||||
@@ -22,29 +22,16 @@
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/unit_test/suite.h>
|
||||
|
||||
#include <beast/utility/static_initializer.h>
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
namespace beast {
|
||||
|
||||
// We need to make a shared singleton or else there are
|
||||
// issues with the leak detector and order of detruction.
|
||||
//
|
||||
class NonexistentHolder
|
||||
File const& File::nonexistent()
|
||||
{
|
||||
public:
|
||||
static NonexistentHolder* getInstance()
|
||||
{
|
||||
return SharedSingleton <NonexistentHolder>::getInstance();
|
||||
}
|
||||
|
||||
File file;
|
||||
};
|
||||
|
||||
File const& File::nonexistent ()
|
||||
{
|
||||
return NonexistentHolder::getInstance ()->file;
|
||||
static beast::static_initializer<File> instance;
|
||||
return *instance;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_FILE_H_INCLUDED
|
||||
#define BEAST_FILE_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_FILES_FILE_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_FILES_FILE_H_INCLUDED
|
||||
|
||||
#include <beast/module/core/containers/Array.h>
|
||||
#include <beast/module/core/memory/MemoryBlock.h>
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_FILEINPUTSTREAM_H_INCLUDED
|
||||
#define BEAST_FILEINPUTSTREAM_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_FILES_FILEINPUTSTREAM_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_FILES_FILEINPUTSTREAM_H_INCLUDED
|
||||
|
||||
namespace beast
|
||||
{
|
||||
@@ -35,7 +35,6 @@ namespace beast
|
||||
*/
|
||||
class FileInputStream
|
||||
: public InputStream
|
||||
, LeakChecked <FileInputStream>
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
namespace beast
|
||||
{
|
||||
|
||||
#ifndef BEAST_FILEOUTPUTSTREAM_H_INCLUDED
|
||||
#define BEAST_FILEOUTPUTSTREAM_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_FILES_FILEOUTPUTSTREAM_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_FILES_FILEOUTPUTSTREAM_H_INCLUDED
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
@@ -35,7 +35,6 @@ namespace beast
|
||||
*/
|
||||
class FileOutputStream
|
||||
: public OutputStream
|
||||
, LeakChecked <FileOutputStream>
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_LOGGER_H_INCLUDED
|
||||
#define BEAST_LOGGER_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_LOGGING_LOGGER_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_LOGGING_LOGGER_H_INCLUDED
|
||||
|
||||
#include <beast/strings/String.h>
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_RANDOM_H_INCLUDED
|
||||
#define BEAST_RANDOM_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_MATHS_RANDOM_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_MATHS_RANDOM_H_INCLUDED
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -21,11 +21,10 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_MEMORYBLOCK_H_INCLUDED
|
||||
#define BEAST_MEMORYBLOCK_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_MEMORY_MEMORYBLOCK_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_MEMORY_MEMORYBLOCK_H_INCLUDED
|
||||
|
||||
#include <beast/HeapBlock.h>
|
||||
#include <beast/utility/LeakChecked.h>
|
||||
#include <beast/strings/String.h>
|
||||
|
||||
namespace beast {
|
||||
@@ -35,7 +34,7 @@ namespace beast {
|
||||
A class to hold a resizable block of raw data.
|
||||
|
||||
*/
|
||||
class MemoryBlock : LeakChecked <MemoryBlock>
|
||||
class MemoryBlock
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
|
||||
@@ -1,205 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_SHAREDSINGLETON_H_INCLUDED
|
||||
#define BEAST_SHAREDSINGLETON_H_INCLUDED
|
||||
|
||||
#include <beast/threads/SpinLock.h>
|
||||
#include <beast/smart_ptr/SharedPtr.h>
|
||||
#include <beast/module/core/time/AtExitHook.h>
|
||||
|
||||
#include <atomic>
|
||||
|
||||
namespace beast
|
||||
{
|
||||
|
||||
/** Thread-safe singleton which comes into existence on first use. Use this
|
||||
instead of creating objects with static storage duration. These singletons
|
||||
are automatically reference counted, so if you hold a pointer to it in every
|
||||
object that depends on it, the order of destruction of objects is assured
|
||||
to be correct.
|
||||
|
||||
Object Requirements:
|
||||
DefaultConstructible
|
||||
TriviallyDestructible (when lifetime == neverDestroyed)
|
||||
Destructible
|
||||
|
||||
@class SharedSingleton
|
||||
@ingroup beast_core
|
||||
*/
|
||||
/** @{ */
|
||||
class SingletonLifetime
|
||||
{
|
||||
public:
|
||||
// It would be nice if we didn't have to qualify the enumeration but
|
||||
// Argument Dependent Lookup is inapplicable here because:
|
||||
//
|
||||
// "Base classes dependent on a template parameter aren't part of lookup."
|
||||
// - ville
|
||||
//
|
||||
|
||||
/** Construction options for SharedSingleton
|
||||
|
||||
@ingroup beast_core
|
||||
*/
|
||||
enum Lifetime
|
||||
{
|
||||
/** Created on first use, destroyed when the last reference is removed.
|
||||
*/
|
||||
createOnDemand,
|
||||
|
||||
/** The singleton is created on first use and persists until program exit.
|
||||
*/
|
||||
persistAfterCreation,
|
||||
|
||||
/** The singleton is created when needed and never destroyed.
|
||||
|
||||
This is useful for applications which do not have a clean exit.
|
||||
*/
|
||||
neverDestroyed
|
||||
};
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Wraps object to produce a reference counted singleton. */
|
||||
template <class Object>
|
||||
class SharedSingleton
|
||||
: public Object
|
||||
, private SharedObject
|
||||
{
|
||||
public:
|
||||
typedef SharedPtr <SharedSingleton <Object> > Ptr;
|
||||
|
||||
static Ptr get (SingletonLifetime::Lifetime lifetime
|
||||
= SingletonLifetime::persistAfterCreation)
|
||||
{
|
||||
StaticData& staticData (getStaticData ());
|
||||
SharedSingleton* instance = staticData.instance;
|
||||
if (instance == nullptr)
|
||||
{
|
||||
std::lock_guard <LockType> lock (staticData.mutex);
|
||||
instance = staticData.instance;
|
||||
if (instance == nullptr)
|
||||
{
|
||||
bassert (lifetime == SingletonLifetime::createOnDemand || ! staticData.destructorCalled);
|
||||
staticData.instance = &staticData.object;
|
||||
new (staticData.instance) SharedSingleton (lifetime);
|
||||
std::atomic_thread_fence (std::memory_order_seq_cst);
|
||||
instance = staticData.instance;
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
// DEPRECATED LEGACY FUNCTION NAME
|
||||
static Ptr getInstance (SingletonLifetime::Lifetime lifetime
|
||||
= SingletonLifetime::persistAfterCreation)
|
||||
{
|
||||
return get (lifetime);
|
||||
}
|
||||
|
||||
private:
|
||||
explicit SharedSingleton (SingletonLifetime::Lifetime lifetime)
|
||||
: m_lifetime (lifetime)
|
||||
, m_exitHook (this)
|
||||
{
|
||||
if (m_lifetime == SingletonLifetime::persistAfterCreation ||
|
||||
m_lifetime == SingletonLifetime::neverDestroyed)
|
||||
this->incReferenceCount ();
|
||||
}
|
||||
|
||||
~SharedSingleton ()
|
||||
{
|
||||
}
|
||||
|
||||
void onExit ()
|
||||
{
|
||||
if (m_lifetime == SingletonLifetime::persistAfterCreation)
|
||||
this->decReferenceCount ();
|
||||
}
|
||||
|
||||
void destroy () const
|
||||
{
|
||||
bool callDestructor;
|
||||
|
||||
// Handle the condition where one thread is releasing the last
|
||||
// reference just as another thread is trying to acquire it.
|
||||
//
|
||||
{
|
||||
StaticData& staticData (getStaticData ());
|
||||
std::lock_guard <LockType> lock (staticData.mutex);
|
||||
|
||||
if (this->getReferenceCount() != 0)
|
||||
{
|
||||
callDestructor = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
callDestructor = true;
|
||||
staticData.instance = nullptr;
|
||||
staticData.destructorCalled = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (callDestructor)
|
||||
{
|
||||
bassert (m_lifetime != SingletonLifetime::neverDestroyed);
|
||||
|
||||
this->~SharedSingleton();
|
||||
}
|
||||
}
|
||||
|
||||
typedef SpinLock LockType;
|
||||
|
||||
// This structure gets zero-filled at static initialization time.
|
||||
// No constructors are called.
|
||||
//
|
||||
class StaticData
|
||||
{
|
||||
public:
|
||||
LockType mutex;
|
||||
SharedSingleton* instance;
|
||||
SharedSingleton object;
|
||||
bool destructorCalled;
|
||||
|
||||
StaticData() = delete;
|
||||
StaticData(StaticData const&) = delete;
|
||||
StaticData& operator= (StaticData const&) = delete;
|
||||
~StaticData() = delete;
|
||||
};
|
||||
|
||||
static StaticData& getStaticData ()
|
||||
{
|
||||
static std::uint8_t storage [sizeof (StaticData)];
|
||||
return *(reinterpret_cast <StaticData*> (&storage [0]));
|
||||
}
|
||||
|
||||
friend class SharedPtr <SharedSingleton>;
|
||||
friend class AtExitMemberHook <SharedSingleton>;
|
||||
|
||||
SingletonLifetime::Lifetime m_lifetime;
|
||||
AtExitMemberHook <SharedSingleton> m_exitHook;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
} // beast
|
||||
|
||||
#endif
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_RESULT_H_INCLUDED
|
||||
#define BEAST_RESULT_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_MISC_RESULT_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_MISC_RESULT_H_INCLUDED
|
||||
|
||||
namespace beast
|
||||
{
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_BASICNATIVEHEADERS_H_INCLUDED
|
||||
#define BEAST_BASICNATIVEHEADERS_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_NATIVE_BASICNATIVEHEADERS_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_NATIVE_BASICNATIVEHEADERS_H_INCLUDED
|
||||
|
||||
#include <beast/Config.h>
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_OSX_OBJCHELPERS_H_INCLUDED
|
||||
#define BEAST_OSX_OBJCHELPERS_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_NATIVE_OSX_OBJCHELPERS_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_NATIVE_OSX_OBJCHELPERS_H_INCLUDED
|
||||
|
||||
namespace beast
|
||||
{
|
||||
|
||||
@@ -45,6 +45,9 @@ void CriticalSection::exit() const noexcept { pthread_mutex_unlock (&mutex);
|
||||
|
||||
void Process::terminate()
|
||||
{
|
||||
#ifndef BEAST_MODULE_CORE_NATIVE_POSIX_SHAREDCODE_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_NATIVE_POSIX_SHAREDCODE_H_INCLUDED
|
||||
|
||||
#if BEAST_ANDROID || BEAST_BSD
|
||||
// http://www.unix.com/man-page/FreeBSD/2/_exit/
|
||||
::_exit (EXIT_FAILURE);
|
||||
@@ -459,3 +462,4 @@ std::int64_t File::getVolumeTotalSize() const
|
||||
}
|
||||
|
||||
} // beast
|
||||
#endif
|
||||
|
||||
@@ -399,7 +399,6 @@ bool File::setAsCurrentWorkingDirectory() const
|
||||
|
||||
//==============================================================================
|
||||
class DirectoryIterator::NativeIterator::Pimpl
|
||||
: LeakChecked <DirectoryIterator::NativeIterator::Pimpl>
|
||||
{
|
||||
public:
|
||||
Pimpl (const File& directory, const String& wildCard)
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_FILEINPUTSOURCE_H_INCLUDED
|
||||
#define BEAST_FILEINPUTSOURCE_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_STREAMS_FILEINPUTSOURCE_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_STREAMS_FILEINPUTSOURCE_H_INCLUDED
|
||||
|
||||
namespace beast
|
||||
{
|
||||
@@ -35,7 +35,6 @@ namespace beast
|
||||
*/
|
||||
class FileInputSource
|
||||
: public InputSource
|
||||
, LeakChecked <FileInputSource>
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_INPUTSOURCE_H_INCLUDED
|
||||
#define BEAST_INPUTSOURCE_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_STREAMS_INPUTSOURCE_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_STREAMS_INPUTSOURCE_H_INCLUDED
|
||||
|
||||
namespace beast
|
||||
{
|
||||
@@ -36,7 +36,7 @@ namespace beast
|
||||
|
||||
@see FileInputSource
|
||||
*/
|
||||
class InputSource : LeakChecked <InputSource>
|
||||
class InputSource
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_INPUTSTREAM_H_INCLUDED
|
||||
#define BEAST_INPUTSTREAM_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_STREAMS_INPUTSTREAM_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_STREAMS_INPUTSTREAM_H_INCLUDED
|
||||
|
||||
namespace beast
|
||||
{
|
||||
@@ -38,7 +38,6 @@ class MemoryBlock;
|
||||
@see OutputStream, FileInputStream
|
||||
*/
|
||||
class InputStream
|
||||
: LeakChecked <InputStream>
|
||||
{
|
||||
public:
|
||||
/** Destructor. */
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_MEMORYOUTPUTSTREAM_H_INCLUDED
|
||||
#define BEAST_MEMORYOUTPUTSTREAM_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_STREAMS_MEMORYOUTPUTSTREAM_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_STREAMS_MEMORYOUTPUTSTREAM_H_INCLUDED
|
||||
|
||||
namespace beast
|
||||
{
|
||||
@@ -43,8 +43,7 @@ namespace beast
|
||||
*/
|
||||
class MemoryOutputStream
|
||||
: public OutputStream
|
||||
, LeakChecked <MemoryOutputStream>
|
||||
{
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Creates an empty memory stream, ready to be written into.
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_OUTPUTSTREAM_H_INCLUDED
|
||||
#define BEAST_OUTPUTSTREAM_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_STREAMS_OUTPUTSTREAM_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_STREAMS_OUTPUTSTREAM_H_INCLUDED
|
||||
|
||||
namespace beast
|
||||
{
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_STANDARDINCLUDES_H_INCLUDED
|
||||
#define BEAST_STANDARDINCLUDES_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_SYSTEM_STANDARDINCLUDES_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_SYSTEM_STANDARDINCLUDES_H_INCLUDED
|
||||
|
||||
// Include some common OS headers..
|
||||
#if BEAST_MSVC
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_SYSTEMSTATS_H_INCLUDED
|
||||
#define BEAST_SYSTEMSTATS_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_SYSTEM_SYSTEMSTATS_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_SYSTEM_SYSTEMSTATS_H_INCLUDED
|
||||
|
||||
namespace beast
|
||||
{
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_LEXICALCAST_H_INCLUDED
|
||||
#define BEAST_LEXICALCAST_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_TEXT_LEXICALCAST_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_TEXT_LEXICALCAST_H_INCLUDED
|
||||
|
||||
#include <beast/Config.h>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_STRINGARRAY_H_INCLUDED
|
||||
#define BEAST_STRINGARRAY_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_TEXT_STRINGARRAY_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_TEXT_STRINGARRAY_H_INCLUDED
|
||||
|
||||
#include <beast/strings/String.h>
|
||||
#include <beast/module/core/containers/Array.h>
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_STRINGPAIRARRAY_H_INCLUDED
|
||||
#define BEAST_STRINGPAIRARRAY_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_TEXT_STRINGPAIRARRAY_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_TEXT_STRINGPAIRARRAY_H_INCLUDED
|
||||
|
||||
#include <beast/module/core/text/StringArray.h>
|
||||
|
||||
|
||||
@@ -17,12 +17,13 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/utility/static_initializer.h>
|
||||
|
||||
namespace beast
|
||||
{
|
||||
|
||||
class DeadlineTimer::Manager
|
||||
: public LeakChecked <Manager>
|
||||
, protected Thread
|
||||
: protected Thread
|
||||
{
|
||||
private:
|
||||
typedef CriticalSection LockType;
|
||||
@@ -42,6 +43,14 @@ public:
|
||||
bassert (m_items.empty ());
|
||||
}
|
||||
|
||||
static
|
||||
Manager&
|
||||
instance()
|
||||
{
|
||||
static beast::static_initializer<Manager> m;
|
||||
return *m;
|
||||
}
|
||||
|
||||
// Okay to call on an active timer.
|
||||
// However, an extra notification may still happen due to concurrency.
|
||||
//
|
||||
@@ -210,19 +219,18 @@ private:
|
||||
|
||||
DeadlineTimer::DeadlineTimer (Listener* listener)
|
||||
: m_listener (listener)
|
||||
, m_manager (SharedSingleton <Manager>::getInstance ())
|
||||
, m_isActive (false)
|
||||
{
|
||||
}
|
||||
|
||||
DeadlineTimer::~DeadlineTimer ()
|
||||
{
|
||||
m_manager->deactivate (*this);
|
||||
Manager::instance().deactivate (*this);
|
||||
}
|
||||
|
||||
void DeadlineTimer::cancel ()
|
||||
{
|
||||
m_manager->deactivate (*this);
|
||||
Manager::instance().deactivate (*this);
|
||||
}
|
||||
|
||||
void DeadlineTimer::setExpiration (double secondsUntilDeadline)
|
||||
@@ -232,7 +240,7 @@ void DeadlineTimer::setExpiration (double secondsUntilDeadline)
|
||||
RelativeTime const when (
|
||||
RelativeTime::fromStartup() + secondsUntilDeadline);
|
||||
|
||||
m_manager->activate (*this, 0, when);
|
||||
Manager::instance().activate (*this, 0, when);
|
||||
}
|
||||
|
||||
void DeadlineTimer::setRecurringExpiration (double secondsUntilDeadline)
|
||||
@@ -242,7 +250,7 @@ void DeadlineTimer::setRecurringExpiration (double secondsUntilDeadline)
|
||||
RelativeTime const when (
|
||||
RelativeTime::fromStartup() + secondsUntilDeadline);
|
||||
|
||||
m_manager->activate (*this, secondsUntilDeadline, when);
|
||||
Manager::instance().activate (*this, secondsUntilDeadline, when);
|
||||
}
|
||||
|
||||
} // beast
|
||||
|
||||
@@ -17,10 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_DEADLINETIMER_H_INCLUDED
|
||||
#define BEAST_DEADLINETIMER_H_INCLUDED
|
||||
|
||||
#include <beast/module/core/memory/SharedSingleton.h>
|
||||
#ifndef BEAST_MODULE_CORE_THREAD_DEADLINETIMER_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_THREAD_DEADLINETIMER_H_INCLUDED
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -108,7 +106,6 @@ private:
|
||||
class Manager;
|
||||
|
||||
Listener* const m_listener;
|
||||
SharedPtr <SharedSingleton <Manager> > m_manager;
|
||||
bool m_isActive;
|
||||
RelativeTime m_notificationTime;
|
||||
double m_secondsRecurring; // non zero if recurring
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CORE_THREAD_MUTEXTRAITS_H_INCLUDED
|
||||
#define BEAST_CORE_THREAD_MUTEXTRAITS_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_THREAD_MUTEXTRAITS_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_THREAD_MUTEXTRAITS_H_INCLUDED
|
||||
|
||||
namespace beast
|
||||
{
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_WORKERS_H_INCLUDED
|
||||
#define BEAST_WORKERS_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_THREAD_WORKERS_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_THREAD_WORKERS_H_INCLUDED
|
||||
|
||||
#include <beast/threads/Thread.h>
|
||||
#include <beast/threads/semaphore.h>
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CORE_THREAD_DETAIL_SCOPEDLOCK_H_INCLUDED
|
||||
#define BEAST_CORE_THREAD_DETAIL_SCOPEDLOCK_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_THREAD_DETAIL_SCOPEDLOCK_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_THREAD_DETAIL_SCOPEDLOCK_H_INCLUDED
|
||||
|
||||
#include <beast/module/beast_core/thread/MutexTraits.h>
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CRITICALSECTION_H_INCLUDED
|
||||
#define BEAST_CRITICALSECTION_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_THREADS_CRITICALSECTION_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_THREADS_CRITICALSECTION_H_INCLUDED
|
||||
|
||||
#include <beast/module/core/threads/ScopedLock.h>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_PROCESS_H_INCLUDED
|
||||
#define BEAST_PROCESS_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_THREADS_PROCESS_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_THREADS_PROCESS_H_INCLUDED
|
||||
|
||||
namespace beast {
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_SCOPEDLOCK_H_INCLUDED
|
||||
#define BEAST_SCOPEDLOCK_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_THREADS_SCOPEDLOCK_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_THREADS_SCOPEDLOCK_H_INCLUDED
|
||||
|
||||
namespace beast
|
||||
{
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
namespace beast
|
||||
{
|
||||
#include <beast/utility/static_initializer.h>
|
||||
|
||||
namespace beast {
|
||||
|
||||
// Manages the list of hooks, and calls
|
||||
// whoever is in the list at exit time.
|
||||
@@ -33,7 +34,9 @@ public:
|
||||
|
||||
static inline Manager& get ()
|
||||
{
|
||||
return StaticObject <Manager>::get();
|
||||
static beast::static_initializer<
|
||||
Manager> instance;
|
||||
return *instance;
|
||||
}
|
||||
|
||||
void insert (Item& item)
|
||||
@@ -73,10 +76,6 @@ private:
|
||||
AtExitHook* const hook (item.hook ());
|
||||
hook->onExit ();
|
||||
}
|
||||
|
||||
// Now do the leak checking
|
||||
//
|
||||
LeakCheckedBase::checkForLeaks ();
|
||||
}
|
||||
|
||||
struct StaticDestructor
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CORE_ATEXITHOOK_H_INCLUDED
|
||||
#define BEAST_CORE_ATEXITHOOK_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_TIME_ATEXITHOOK_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_TIME_ATEXITHOOK_H_INCLUDED
|
||||
|
||||
#include <beast/intrusive/List.h>
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_TIME_H_INCLUDED
|
||||
#define BEAST_TIME_H_INCLUDED
|
||||
#ifndef BEAST_MODULE_CORE_TIME_TIME_H_INCLUDED
|
||||
#define BEAST_MODULE_CORE_TIME_TIME_H_INCLUDED
|
||||
|
||||
#include <beast/chrono/RelativeTime.h>
|
||||
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
Portions based on SOCI - The C++ Database Access Library:
|
||||
|
||||
SOCI: http://soci.sourceforge.net/
|
||||
|
||||
This file incorporates work covered by the following copyright
|
||||
and permission notice:
|
||||
|
||||
Copyright (C) 2004 Maciej Sobczak, Stephen Hutton, Mateusz Loskot,
|
||||
Pawel Aleksander Fedorynski, David Courtney, Rafal Bobrowski,
|
||||
Julian Taylor, Henning Basold, Ilia Barahovski, Denis Arnaud,
|
||||
Daniel Lidstr<74>m, Matthieu Kermagoret, Artyom Beilis, Cory Bennett,
|
||||
Chris Weed, Michael Davidsaver, Jakub Stachowski, Alex Ott, Rainer Bauer,
|
||||
Martin Muenstermann, Philip Pemberton, Eli Green, Frederic Chateau,
|
||||
Artyom Tonkikh, Roger Orr, Robert Massaioli, Sergey Nikulov,
|
||||
Shridhar Daithankar, S<>ren Meyer-Eppler, Mario Valesco.
|
||||
|
||||
Boost Software License - Version 1.0, August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_SQDB_BACKEND_H_INCLUDED
|
||||
#define BEAST_SQDB_BACKEND_H_INCLUDED
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace beast {
|
||||
namespace sqdb {
|
||||
|
||||
namespace detail {
|
||||
|
||||
//signed char
|
||||
//wchar_t
|
||||
|
||||
// supported standard types for intos and uses
|
||||
enum exchange_type
|
||||
{
|
||||
x_null, // only for input variables
|
||||
|
||||
x_bool,
|
||||
x_char, x_uchar,
|
||||
x_short, x_ushort,
|
||||
x_int, x_uint,
|
||||
x_long, x_ulong,
|
||||
x_longlong, x_ulonglong,
|
||||
x_float, x_double, x_longdouble,
|
||||
|
||||
x_cstring, // null terminated char*, only valid for use_type
|
||||
x_cwstring, // null terminated wchar*, only valid for use_type
|
||||
x_stdstring,
|
||||
x_stdwstring,
|
||||
x_beastString,
|
||||
|
||||
x_stdtm,
|
||||
|
||||
x_blob
|
||||
};
|
||||
|
||||
} // detail
|
||||
|
||||
// the enum type for indicator variables
|
||||
enum indicator
|
||||
{
|
||||
i_ok,
|
||||
i_null,
|
||||
i_truncated
|
||||
};
|
||||
|
||||
// sqlite row id
|
||||
|
||||
//typedef sqlite3_int64 rowid;
|
||||
typedef std::int64_t rowid;
|
||||
|
||||
} // sqdb
|
||||
} // beast
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user