Compare commits

...

494 Commits

Author SHA1 Message Date
Vinnie Falco
29a4f61551 Set version to 0.23.0 2014-03-14 13:01:23 -07:00
Vinnie Falco
c2fd1215f5 Refactor beast::asio:
* New tools for completion handlers:
  - wrap_handler provides composed io_service execution guarantees.
  - bind_handler rebinds arguments to handlers.
  - shared_handler type-erases any completion handler.
  - buffer_sequence type-erases templated BufferSequences
  - abstract_socket replaces Socket
  - socket_wrapper replaces SocketWrapper
  - beast::asio placeholders to work with std::bind

* Removed obsolete classes and functions
  - AbstractHandler
  - ComposedAsyncOperation
  - SharedFunction
  - SharedHandler
  - SharedHandlerAllocator
  - SharedHandlerPtr
  - SharedHandlerType
  - SocketBase
  - SocketWrapperStrand
  - wrapHandler

* Refactored classes to use new tools
  - abstract_socket
  - socket_wrapper
  - HandshakeDetector
  - HttpClientType

* Miscellanous tidying
  - socket classes moved to beast::asio namespace
  - beast asio files provide their own namespace declaration.
  - Fix IsCallPossible conflicting template parameter name
  - Use <boost/get_pointer.hpp> for C++11 compatibility.
  - Remove extraneous include path from build environment.
2014-03-14 08:03:48 -07:00
Vinnie Falco
e3c1375f36 Add std::integer_sequence C++14 compatibility 2014-03-14 07:57:20 -07:00
Vinnie Falco
4e357601ec Move MultiSocket, RippleSSLContext to common module 2014-03-14 07:57:20 -07:00
Vinnie Falco
3674b01634 Add ripple::byte_view, ripple::const_byte_view 2014-03-14 07:57:20 -07:00
Vinnie Falco
f66aee4e7f Add beast::buffer_view 2014-03-14 07:57:19 -07:00
Vinnie Falco
b2f06dbe3c Add C++11 noexcept compatibility for VS2013 2014-03-14 07:57:19 -07:00
sublimator
b78076670e Fix typos: tecMASTER_DISABLED, tecNO_REGULAR_KEY 2014-03-14 07:57:18 -07:00
sublimator
a08a0703b6 Remove Jenkins CI build status badge
This isn't used any more is it?
2014-03-13 21:15:13 -07:00
sublimator
f80561e6aa Travis: disable gdb thread event logging
Attempt 2
2014-03-13 21:15:13 -07:00
JoelKatz
f5765b71f2 Handle unexpected relative paths from __FILE__
Fixes comref#RIPD-133
2014-03-13 16:49:20 -07:00
Vinnie Falco
6a6be847c0 Set version to 0.23.0-rc1 2014-03-12 19:05:08 -07:00
Nik Bougalis
4e26108a06 Protect callers of MultiSocket::remote_endpoint from exceptions 2014-03-12 13:51:00 -07:00
JoelKatz
c517d261bb Return a sensible error for unknown inner JSON fields 2014-03-12 00:54:00 -07:00
JoelKatz
5522a23670 Don't relay old proposals. 2014-03-11 22:21:34 -07:00
JoelKatz
64345f90a8 Allow setting LedgerConsensus to TRACE 2014-03-11 22:12:48 -07:00
JoelKatz
879c0d6b78 Be less promiscuous relaying proposals 2014-03-11 21:49:46 -07:00
Nik Bougalis
2e8df429df Expose PeerImp::start instead of requiring the use of accept/connect 2014-03-11 19:02:18 -07:00
JoelKatz
7aa1222310 Fix the "peer action" transition from syncing to full 2014-03-11 19:02:18 -07:00
JoelKatz
2b5142ee4d Make transaction forwarding less promiscuous 2014-03-11 19:02:17 -07:00
Nik Bougalis
e8d7d339ef Transactor refactoring:
- Reorganize transactor source files and VS project
- Don't expose Transactor interfaces to anyone but the TransactionEngine
- Improve compile times
- Begin using Journal
2014-03-11 19:02:17 -07:00
Nik Bougalis
5324a6d59d Don't create a Transactor if we don't have a valid TxID 2014-03-11 19:02:17 -07:00
Nik Bougalis
569b3a46a1 Cleanups:
- Cleanup VotableInteger class and remove unused duplicate
 - Remove obsolete function and move to std functions
 - Fix typos
 - Make isMemoOkay a free function
 - Sanitize error returns
2014-03-11 19:02:17 -07:00
JoelKatz
fc129e43fd Cleanup handling of expired offers 2014-03-11 19:02:16 -07:00
JoelKatz
b22a0f4a97 Ensure offer cleanup is deterministic 2014-03-11 19:02:16 -07:00
JoelKatz
cf63b5c859 Fix logging transactions that throw 2014-03-11 19:02:16 -07:00
David Schwartz
b4593a274d Limit how many reads we defer to avoid overflowing the cache 2014-03-11 19:02:16 -07:00
David Schwartz
163daf012a Add 'MemoData' field 2014-03-11 19:02:16 -07:00
JoelKatz
63df034bcf Clean up job renaming 2014-03-11 19:02:16 -07:00
David Schwartz
60787be80c Check the node store for transaction nodes with metadata 2014-03-11 19:02:15 -07:00
David Schwartz
f42ae3af21 Add ledger_data command to get full ledgers in pieces 2014-03-11 19:02:15 -07:00
David Schwartz
b1fea3c51e Disable retrieving full state trees for non-admins. 2014-03-11 19:02:15 -07:00
David Schwartz
16d2bbd6e5 Avoid disk I/O when data 'moves' in a SHAMap 2014-03-11 19:02:15 -07:00
David Schwartz
2505a908c5 Logging reduction in PeerImp 2014-03-11 19:02:15 -07:00
Nik Bougalis
4b71673ee9 Improve validation of JSON inputs 2014-03-11 19:02:14 -07:00
Nik Bougalis
242494a9ad Allow a server to keep no ledger history, closes #299 2014-03-11 19:02:14 -07:00
Nik Bougalis
3a684ce280 Robust HashPrefix initialization, closes #300 2014-03-11 19:02:14 -07:00
Nik Bougalis
756da7b844 Fix strUnHex parsing of odd-length strings and add unit tests 2014-03-11 19:02:14 -07:00
Nik Bougalis
9c465487ae Cache the result of remote_endpoint at connect/accept time and use it 2014-03-11 19:02:14 -07:00
Donovan Hide
e8002a7a62 Fix ledger log warning, closes #298 2014-03-11 19:02:13 -07:00
Nik Bougalis
5a53b48026 Require a C++11 conforming compiler 2014-03-11 19:02:13 -07:00
Vinnie Falco
b3f725d9fd Update http code for http parser API changes 2014-03-06 21:44:29 -08:00
Vinnie Falco
50f5d5bdf3 Merge commit '6c0edd2190bfd18ffc523f486367da3724cf98a3' into develop 2014-03-06 21:22:22 -08:00
Vinnie Falco
6c0edd2190 Squashed 'src/beast/beast/http/impl/http-parser/' changes from 547553b..cba704c
cba704c Bump version to 2.2.1
a252d4e fix content-length and chunk-size overflow test
42d6541 add vc project files to .gitignore
fd609ab Bump version to 2.2
efcf75d test: better fix for __APPLE__ test build
9ca484d test: fix build on osx
d7b938b Parse and emit status message of response
11419c8 Use unsigned int as bitfield type.
c4079e7 Add syntax highlighting to README C code
f5c779b Update misleading comment.
3cbd13d test: add amazon.com response test

git-subtree-dir: src/beast/beast/http/impl/http-parser
git-subtree-split: cba704cb2d9f1df80994dd4a791a0fa6cce65720
2014-03-06 21:22:22 -08:00
Vinnie Falco
d9a0181189 Set version to 0.22.0 2014-03-04 15:43:34 -08:00
Howard Hinnant
09570996a9 Fix beast::asio failures on OS X.
There are 38 unittest failures on OS X.  These changes address all of
them by adjusting which side of the socket (send or receive) gets
shut down.  In each case, the failure was 'Socket is not connected'.
I've interpreted that to mean that the other thread had already shut
down its side of the connection.
2014-03-04 15:43:33 -08:00
JoelKatz
adc4c855ca Fix the ledger range we advertise to peers 2014-03-04 15:43:33 -08:00
Nik Bougalis
8b1df06a94 PeerFinder fixes:
* Fix local advertisement (was missing)
* Fix Livecache histogram display
* If no [ips] are specified, use r.ripple.com
* Use different backing stores for PeerFinder and Validator databases
2014-03-04 15:43:32 -08:00
Vinnie Falco
7c81eec30c Remove unused TextDiff 2014-03-04 07:23:53 -08:00
Vinnie Falco
faa999d6d0 Consolidate C++14 compatibility into new headers 2014-03-03 18:51:56 -08:00
David Schwartz
370bfb7a22 Permit memos up to 1Kb.
* Overlong memos are basically treated like invalid signatures.
* Ability to clear message key.
2014-03-03 18:51:55 -08:00
David Schwartz
ae649ec917 Signature canonicalization and transaction mutation fixes 2014-03-03 18:51:55 -08:00
JoelKatz
93b44fcdc1 Return an empty pointer from getLedgerBySeq if sequence in future 2014-03-03 14:07:18 -08:00
David Schwartz
1fe57720c4 Legacy Pathfinding API improvements:
* Use the cache for source/dest currencies
* Allow a search depth and initial paths to be specified in old pathfinding
2014-03-03 10:59:31 -08:00
JoelKatz
fca8fa1b1b Clean up ledger fetch reasons.
Don't trigger immediately when fetching historical ledgers.
2014-03-03 10:57:36 -08:00
David Schwartz
81082ad10f Don't check the node store for proposed txn nodes 2014-03-03 10:57:31 -08:00
David Schwartz
2c515636cb Release the InboundLedger lock during getMissingNodes 2014-03-03 10:57:26 -08:00
David Schwartz
2f7ac98e34 Improve I/O when fetching ledgers
* negative cache for node store
* async fetch, thread pool for node store
* read barrier logic for node store
* SHAMap getMissingNodesNB (non-blocking)
* non-blocking getMissingNodes traverse
* tune caches
2014-03-03 10:56:48 -08:00
Nik Bougalis
37b39ed1a1 Update LICENSE 2014-03-01 11:54:11 -08:00
Nik Bougalis
73485d5a23 Resolve hostnames found in the [ips] config section 2014-03-01 11:53:57 -08:00
Nik Bougalis
28c7827f14 Calculate program file directories:
* Determine location of database files in Config
* Inject database directory or file path in PeerFinder and Validators
* PeerFinder and Validators will share the same sqlite file
2014-03-01 11:53:57 -08:00
JoelKatz
e055dc1513 WebSocket dispatch changes.
Don't let one connection hold a thread for too long without
having to wait for another turn
2014-02-28 12:18:15 -08:00
JoelKatz
c173f14fc0 Give pathfinding updates priority over client and RPC requests 2014-02-28 12:15:41 -08:00
Howard Hinnant
cd30e552a7 Fix clang warnings 2014-02-28 12:15:12 -08:00
Vinnie Falco
9bf1a76e91 Remove unused classes 2014-02-28 12:03:33 -08:00
Vinnie Falco
2957b688fd PeerFinder and Peers fixes:
- Fix bootcache incorrect failure on socket cancel
- Fix peer connect race on stop
- Simplify some loops
- Require boost 1.55 via static_assert
2014-02-28 12:03:33 -08:00
JoelKatz
add40d524f Merge pull request #296 from nbougalis/quickfix-jobcount
Fix variable mismatch for job counts
2014-02-26 14:38:51 -08:00
Nik Bougalis
04a55e35b6 Fix variable mismatch for job counts 2014-02-26 14:29:00 -08:00
JoelKatz
955ce45448 Fix the assert on a self-connect 2014-02-24 22:30:04 -08:00
Vinnie Falco
995e64a205 PeerFinder fixes:
* Fix split horizon using recent address cache
* Change message tuning parameters to reduce dead messages
* Improved peer handout algorithm for addresses
* Improved handout algorithm for redirects
* Improved selection algorithm for autoconnect
* Faster autoconnection strategy
* Consolidate deadline timers
* Send empty endpoints message as a socket ping
* Fix hop count adjustments for live cache filtering
* Remove broken Peer::isConnected function
* Optimized Livecache for handouts
* Optimized Bootcache for handouts
* Remove uptime metric from Bootcache entries
* Add histogram to Livecache print output
2014-02-24 19:25:01 -08:00
Vinnie Falco
bf085f0ef3 New utility classes, containers, C++14 compatibility, and fixes:
* Add std::equal_to <void> (since C++14)
* Add heterogeneous std::equal (since C++14)
* Add maybe_const
* Add empty_base_optimization
* Add is_constructible specialization for pair, tuple
* Add aged associative containers:
  - aged_set, aged_map, aged_multiset, aged_multimap
  - aged_unordered_set, aged_unordered_map,
  - aged_unordered_multiset, aged_unordered_multimap
* Fix auto keyword pass by reference
* Fix basic_seconds_clock warning and project file
2014-02-24 19:25:01 -08:00
David Schwartz
1374b37882 Remove dead serializer signature code 2014-02-24 18:28:44 -08:00
JoelKatz
e275f4eb9d Handle a removed peer when counting ledger use 2014-02-24 18:28:43 -08:00
JoelKatz
652d809129 Validate params before dispatching 2014-02-24 18:28:43 -08:00
JoelKatz
c186519bcf Ledger fetch fixes. 2014-02-24 18:28:42 -08:00
Nik Bougalis
870fb4f291 Fix missing break on mtCLUSTER handler 2014-02-24 18:28:42 -08:00
Nik Bougalis
7cd63489f4 Refactor Job tracking and statistics gathering 2014-02-23 01:47:35 -08:00
Vinnie Falco
616a53888e Use forward_tuple to prevent needless copies 2014-02-22 21:33:01 -08:00
Vinnie Falco
a336cc26f9 Remove deprecated IPAddress 2014-02-22 21:33:00 -08:00
Howard Hinnant
382088c456 Add find_create stat to InboundLedgers 2014-02-22 21:33:00 -08:00
Howard Hinnant
ff80531db4 Update LICENSE 2014-02-22 21:32:59 -08:00
Vinnie Falco
105cf3cd1e Revert "Tidy up build scripts:"
This reverts commit 66b5f75142.
2014-02-22 21:32:59 -08:00
JoelKatz
38ba7e695a Don't hold the master lock 2014-02-21 14:46:57 -08:00
JoelKatz
996326a00e Configurable fetch depth. 2014-02-17 17:26:58 -08:00
JoelKatz
f2beb82b97 Pathfinding dispatch improvements
* Keep requests forwards, flip only on insert
* Insert requests in more sensible order (after new, before old)
* Remove a redundant cache/request check
2014-02-17 17:26:50 -08:00
JoelKatz
41c0702408 Fix custom currency parsers 2014-02-17 17:26:43 -08:00
Nik Bougalis
66b5f75142 Tidy up build scripts:
* Relax the boost -mt link requirement for Debian
* Tidy up scons output, reduce verbosity, add color
2014-02-17 15:50:51 -08:00
JoelKatz
c2a16ddbab Cannot call gotTXData without master lock ... yet! 2014-02-14 14:26:03 -08:00
Vinnie Falco
5bb194cf89 PeerFinder fixes:
* Add Livecache property stream support
* Tidy up log output
* Move peer code to ripple_overlay module
* Remove or hide some Peer interfaces
* Fix asserts by removing isConnected which was not thread safe
2014-02-14 14:00:51 -08:00
Vinnie Falco
645b9a01c7 Make abstract_clock members const 2014-02-14 11:14:09 -08:00
Vinnie Falco
3a1a5d12de Refactor PeerFinder:
* Revise documentation in README.md
* Inject abstract_clock in Manager
* Introduce the Slot object as a replacement for Peer
* New bullet-proof method for slot accounting
* Replace Peer with Slot for tracking connections
* Prevent duplicate outbound connection attempts
* Improved connection and bootstrap business logic
* Refactor PeerImp, PeersImp private interfaces
* Give PeersImp access to the PeerImp interface
* Handle errors retrieving endpoints from asio sockets
* Use weak_ptr to manage PeerImp lifetime
* Better handling of socket closure in PeerImp
* Improve the orderly shutdown logic of PeersImp
2014-02-13 14:19:27 -08:00
Vinnie Falco
12748e7539 Add chrono APIs to DeadlineTimer 2014-02-12 12:58:20 -08:00
Nicholas Dudfield
2f69d4c8ee Update Travis matrix:
* New clang compiler target
* Sconstruct changes for clang
* Patches to support clang
2014-02-11 19:13:51 -08:00
Nicholas Dudfield
8dbf8b9038 Fix clang compile error 2014-02-11 19:13:45 -08:00
Vinnie Falco
fdfe047f3e Fix new RPC dispatcher params 2014-02-11 19:05:08 -08:00
Vinnie Falco
38c3f84c9f Update beast project file 2014-02-10 19:48:37 -08:00
Vinnie Falco
9c5b071556 Fix crash on exit in ~InboundLedger 2014-02-08 11:07:10 -08:00
Vinnie Falco
46dc52e449 Fix insight object lifetimes in Group 2014-02-08 10:48:54 -08:00
Vinnie Falco
f469e3853d Insight support for jobs:
* Add insight Groups to Application singleton
* Put JobQueue metrics into "jobq" Group
* Add queued time to Job
* Add per-type Job queue time metrics
* Add per-type Job execution time metrics
* Break JobQueue sources out of the namespace
* Use free function to create the JobQueue
2014-02-08 10:09:22 -08:00
Vinnie Falco
a681a4fcd4 Improved logging for insight stat packets 2014-02-08 09:33:04 -08:00
Vinnie Falco
575b0bb7b0 Fix gcc compile 2014-02-07 09:09:01 -08:00
sublimator
588cf4bfca Update travis to use boost 1.55 2014-02-07 08:09:24 -08:00
NATTSiM
9cc8c341e7 Fix clang compile 2014-02-07 08:09:15 -08:00
Vinnie Falco
9b657ba224 Refactor RPC module:
* Move JsonPropertyStream to ripple_json
* Remove unused RPC service manager
* Recreate RPC module in app code area
* Add RPC::Manager
* Add DoPrint handler
2014-02-06 18:21:08 -08:00
Vinnie Falco
9bc6e83f8a Change bassert to always call assert 2014-02-06 14:30:03 -08:00
Nik Bougalis
572aae320d Performance fixes: decongest master lock 2014-02-05 15:57:10 -08:00
Nik Bougalis
2906899811 Ignore ports when checking RPC IP filter list 2014-02-05 15:57:09 -08:00
Nik Bougalis
1a6bf88900 Resolver Work:
* Don't stall during shutdown
* Properly handle unit test execution
* Handle whitespace when parsing names to resolve
2014-02-05 15:57:09 -08:00
Nik Bougalis
e60b28980a PeerFinder work and refactoring:
* Implement PeerFinder business logic.
* Support fixed peers (including DNS support).
* Add journal support to Peer and Peers.
* Refactor PeerDoor support.
* Tidy up Peers and eliminate connection functionality and timers.
* Refactor Peer interface and add journal support.
* Allow construction of incoming Peer using an existing socket.
* Remove TESTNET support.
* Allow connections from/to cluster peers without consuming slots
* Misc. cleanups.
2014-02-05 15:56:04 -08:00
Vinnie Falco
a253b2ef4b Refactor IP::Endpoint 2014-02-05 15:53:16 -08:00
Vinnie Falco
0c2e35edc9 Remove obsolete Visual Studio projects 2014-02-05 15:42:28 -08:00
Vinnie Falco
d0970397a6 Revert system test changes:
* Revert "Shutdown rippled before http server in json rpc test to avoid http server potentially receiving messages due to automatic ledger close interval."
* Revert "Update ripple-lib integration tests"

This reverts commit 83442825e5.
2014-02-04 15:18:36 -08:00
Vinnie Falco
0afbda0351 Redirect Visual Studio 2013 project output 2014-02-04 09:25:27 -08:00
Vinnie Falco
2009f8b1ca Add insight support to TaggedCache, KeyCache:
* Move TaggedCache, KeyCache to common
* Add radmap module, FullBelowCache class
* Add get_seconds_clock
* Inject FullBelowCache in SHAMap
2014-02-03 23:00:45 -08:00
Vinnie Falco
35715a0146 Add basic_seconds_clock, insight::Groups 2014-02-03 22:55:47 -08:00
Vinnie Falco
20e27ceb04 Update Visual Studio 2013 project file 2014-02-03 22:36:29 -08:00
Vinnie Falco
7fb614f7af Fix application pointer singleton lifetime 2014-02-03 22:36:28 -08:00
Nicholas Dudfield
83442825e5 Shutdown rippled before http server in json rpc test to avoid http server potentially receiving messages due to automatic ledger close interval. 2014-02-03 22:36:28 -08:00
Nik Bougalis
123c482a69 Robustly validate input to the 'ledger' RPC command 2014-02-03 18:43:21 -08:00
Vinnie Falco
3f091fce59 Update project build requirements
* Add Visual Studio 2013 project file
* Update SConstruct for boost 1.55.0
2014-02-03 16:58:32 -08:00
wltsmrz
6c5f88aa25 Update ripple-lib integration tests 2014-02-03 10:42:34 -08:00
Vinnie Falco
23eccebf5b Fix crash on exit via Application singleton 2014-02-01 21:28:12 -08:00
Vinnie Falco
15112c1a27 Fix mutable tx json field for autofill_fee 2014-02-01 07:10:53 -08:00
David Schwartz
d0ca81ff36 visitLeaves must visit all branches 2014-01-31 19:26:53 -08:00
David Schwartz
3e218c494d Enlarge the humanAccountID cache 2014-01-31 19:26:53 -08:00
David Schwartz
88bd5b12a4 Raise RPC time and size limits 2014-01-31 19:26:53 -08:00
David Schwartz
5df5983f88 Fix missing call to setHeartbeatTimer 2014-01-31 19:26:53 -08:00
David Schwartz
aa5ca7cea5 Don't copy the parameters when calling lookupLedger 2014-01-31 19:26:53 -08:00
David Schwartz
02483b2e0b Avoid race conditions updating ledger fee entries 2014-01-31 19:26:53 -08:00
David Schwartz
f7817866ba call pubValidatedTransactions, we may have book listeners 2014-01-31 19:26:53 -08:00
JoelKatz
d62287d54b Calculate correct fee in RPC sign/submit, error if over limit 2014-01-31 19:26:53 -08:00
Nicholas Dudfield
aad074cd8e Tweak to path-finding tests. Specify test patterns outside of mocha.opts 2014-01-31 19:05:10 -08:00
Vinnie Falco
580d179dd0 Tidy up Validators logging 2014-01-29 07:53:27 -08:00
Vinnie Falco
616a514c4d Fix PropertyStream overloads 2014-01-29 07:53:27 -08:00
NATTSiM
bac8d41954 Pass IPAddress in getAdminRole 2014-01-28 22:52:11 -08:00
JoelKatz
f295bb20a1 Set version to 0.21.0.rc2 2014-01-24 11:17:16 -08:00
JoelKatz
b5ffa2351a DirectoryEntryIterator fix 2014-01-24 10:54:56 -08:00
JoelKatz
1b37b52071 Whitespace changes 2014-01-24 10:54:47 -08:00
JoelKatz
b1ffd10079 Fix "limit" mishandling in doBookOffers 2014-01-24 10:53:55 -08:00
Vinnie Falco
39235f5b91 Set version to 0.21.0.rc1 2014-01-23 23:31:26 -05:00
JoelKatz
8825d94636 Temporarily change getBookPage not to use OB iterators 2014-01-23 16:26:45 -08:00
JoelKatz
c8a7b2af56 Prevent infinite loop in getBookPage 2014-01-23 16:05:38 -08:00
JoelKatz
d22b25c030 Set version to 0.21.0 2014-01-23 13:38:38 -08:00
JoelKatz
d475994e02 Pairwise no ripple:
* Cannot set noRipple flag with negative balance.
* Paths with consecutive no ripple links are invalid
* Adjust pathfinding value of no ripple out paths
* Check for no ripple when adding links in pathfinding
* Remove old noRipple logic
* Update trust line delete logic
2014-01-23 13:38:33 -08:00
JoelKatz
f0bb3dfdfb Never allow a retry as a final result 2014-01-23 13:38:28 -08:00
JoelKatz
e7f0b8eca6 Add DeliveredAmount to transaction metadata 2014-01-23 13:38:25 -08:00
JoelKatz
0bab6a9fec Add directory and order book iterators
This should fix the crossed order book bug.
* Change OfferCreate::takeOffers to use new iterators
* Change NetworkOps::getBookPage to use new iterators
* If we find an offer in the book but not the ledger, deindex it
2014-01-23 13:38:11 -08:00
David Schwartz
9486fc416c Support AccountTxnID and LastLedgerSequence. 2014-01-23 13:37:46 -08:00
JoelKatz
fb63aa737a Revert d2953f602e 2014-01-23 13:36:31 -08:00
JoelKatz
58a6ca1d3d Remove extraneous logging 2014-01-23 13:24:51 -08:00
JoelKatz
505f029edb Clean up 'destination_currencies' in new pathfinding reply 2014-01-23 13:24:43 -08:00
JoelKatz
815659b898 Replace a lock with an atomic in new pathfinding 2014-01-23 13:24:33 -08:00
JoelKatz
07d16f280c Clean up the checkAccept path to use the ledger sequence 2014-01-23 13:24:28 -08:00
JoelKatz
f88ddc947c Handle non-object in 'json' RPC method 2014-01-23 13:24:22 -08:00
Vinnie Falco
65ffdff40c Insight support for ResourceManager 2014-01-21 10:28:36 -05:00
Vinnie Falco
c95dccfec6 Move PathRequests to separate files 2014-01-21 10:28:36 -05:00
Vinnie Falco
fe83f471f5 Use duration in insight::Event, add chrono_util 2014-01-21 10:28:35 -05:00
sublimator
d2953f602e Error reporting tests 2014-01-21 10:28:35 -05:00
Vinnie Falco
9d07ddeae1 Improved human readable JSON-RPC error messages 2014-01-21 10:28:34 -05:00
Vinnie Falco
ef7810bc95 Add ScopedPointer::reset 2014-01-21 10:28:34 -05:00
David Schwartz
486539b3d3 Make offerDelete and fill Items more robust. 2014-01-21 10:28:34 -05:00
David Schwartz
990fb20a2a OrderBookDB::addOrderBook cleanup 2014-01-21 10:28:33 -05:00
Vinnie Falco
9b61a83721 Refactor, tidy up:
* Fix for msvc std::function return types
* Convert macros to constants
* Add Journal to PeerSet and use in InboundLedger
* Break lines and add annotations
* Remove some warnings
2014-01-21 10:28:33 -05:00
JoelKatz
f753519976 Ledger fetch improvements. Fetch policy improvements. 2014-01-17 16:06:15 -08:00
David Schwartz
663e38dcdd Locking and dispatching performance improvements:
* Avoid taking the master lock in most peer operations
* Dispatch recvGetLedger to JobQueue
* Dispatch consensus ledger fetches.
* Release master lock earlier in RPCHandler
2014-01-17 16:05:48 -08:00
Vinnie Falco
7570b6489d Fix and tidy up NodeStore
* Use std::unique_ptr
* Move globals to Manager singleton (fixes RocksDB exit crash)
2014-01-17 15:21:51 -05:00
Vinnie Falco
c341d1a71e Tidy up for C++11, and fixes:
* Remove shared_ptr legacy support
* Add make_unique support for pre-C++14 environments
* Fix comparison bug in sqdb
* Use std::shared_ptr in a few places
2014-01-17 12:19:04 -05:00
Vinnie Falco
fa10e90c9d Use abstract_clock 2014-01-17 12:19:04 -05:00
Vinnie Falco
68501763dd Refactor KeyCache 2014-01-17 12:19:04 -05:00
Vinnie Falco
cac1d555be Add std::make_unique 2014-01-17 12:19:03 -05:00
NATTSiM
25ff77c2fd Fix Clang compile and link errors 2014-01-16 17:18:05 -05:00
Vinnie Falco
2870c7f457 Workaround for MSVC std::function bug 2014-01-15 19:10:08 -08:00
JoelKatz
ab8d7a86ae Dispatch peerHas to JobQueue 2014-01-14 11:24:41 -08:00
JoelKatz
809359e81e Correctly handle empty account tree in ledger fetch 2014-01-14 11:24:32 -08:00
JoelKatz
6e4cd5bc9c Don't send nodes twice in getNodeFat 2014-01-14 11:24:01 -08:00
NATTSiM
de018bd582 Improved PropertyStream find and print routines 2014-01-13 21:51:31 -08:00
Vinnie Falco
544642a6ea Fix io_latency_probe hang on exit 2014-01-13 18:24:22 -08:00
JoelKatz
06737bb36f SHAMapSync bugfix. Cannot avoid push in getMissingNodes 2014-01-13 09:50:54 -08:00
JoelKatz
7efbfa2d20 Limit legacy pathfinding requests 2014-01-10 23:09:26 -08:00
Vinnie Falco
4d5df92cbc Add io_latency_probe 2014-01-10 22:54:00 -08:00
David Schwartz
1fcb2872b9 Reduce log priorities. 2014-01-10 22:54:00 -08:00
David Schwartz
00c87ca2dd Add LES::dirIsEmpty function to check if a directory is empty 2014-01-10 22:53:59 -08:00
JoelKatz
d474d68566 Order book subscribe cleanups. 2014-01-10 22:53:59 -08:00
David Schwartz
93e03804d0 SHAMapSync cleanups and performance improvements 2014-01-10 22:53:58 -08:00
JoelKatz
4591658160 PathRequests object to own all path requests. 2014-01-10 22:53:57 -08:00
JoelKatz
a2109b4bda Remove files inadvertently added 2014-01-10 22:53:57 -08:00
Vinnie Falco
deafea9c88 [REMOVE] Allow gcc 4.7 and later 2014-01-10 22:53:57 -08:00
Nicholas Dudfield
93f1a05f5c Update build for gcc 4.8.x:
* Use gcc 4.8.x, boost 1.54
* Honor CC,CXX,PATH environment variables
* Prevent compilation with unsupported toolchains
* Print g++ version during Travis build
* Run built-in unit tests after Travis build
2014-01-10 16:24:17 -08:00
Vinnie Falco
95a573b755 Set version to 0.20.1 2014-01-08 17:08:27 -08:00
Nik Bougalis
2a4623814c Don't log StatsD messages to the console by default 2014-01-08 16:57:47 -08:00
Vinnie Falco
1017adf743 Set version to 0.20.0 2014-01-08 16:15:12 -08:00
Vinnie Falco
34fb12344c Fix JobQueue 2014-01-08 14:55:10 -08:00
Vinnie Falco
ce3358bdf8 Improve diagnostics for ResourceManager 2014-01-08 11:18:46 -08:00
Vinnie Falco
1159dadfdb Fix missing jtACCEPT job limit 2014-01-08 11:18:45 -08:00
Vinnie Falco
62516ef07f Refactor TaggedCache 2014-01-07 21:14:14 -08:00
Vinnie Falco
eecd305efd Add std::hash <std::pair> specialization 2014-01-07 21:14:13 -08:00
Vinnie Falco
a83fa6b2b2 Fix warning in chrono_io 2014-01-07 21:14:07 -08:00
Vinnie Falco
b2feafa94c Use abstract_clock and improved tests, in ResourceManager
Conflicts:
	Builds/VisualStudio2012/RippleD.vcxproj.filters
2014-01-07 17:23:26 -08:00
Vinnie Falco
2d234e500d Add abstract_clock, manual_clock, chrono_io
Conflicts:
	src/beast/Builds/VisualStudio2012/beast.vcxproj.filters
2014-01-07 17:17:26 -08:00
Vinnie Falco
fee0e7b20e Fix bind in call to addJob 2014-01-07 17:08:01 -08:00
JoelKatz
a0f6429652 Add LedgerHolder class, use in LedgerMaster 2014-01-07 15:57:51 -08:00
JoelKatz
8f8b2ae4a3 Handle offers in quality directory but not in ledger 2014-01-07 15:57:50 -08:00
JoelKatz
9abdd16721 Release the master lock earlier in a few cases 2014-01-07 15:57:50 -08:00
JoelKatz
1e5963aeeb Move some operations from the I/O queue to the Job queue 2014-01-07 15:57:50 -08:00
JoelKatz
e25a83bb39 Some tiny bugfixes:
* Don't let ledger idle interval get too short
* Fix CBigNum::setuint256
* Fix SqliteStatement::isError
* Remove dead code, fix incorrect comments
* Check for NULL earlier in CKey constructors
* Prevent expire times from underflowing in TaggedCache
2014-01-07 15:57:49 -08:00
David Schwartz
e3a67b13ff Reset liquidity before retrying rippleCalc 2014-01-07 15:57:48 -08:00
JoelKatz
750cbb8399 Improvements because items in SHAMaps are immutable:
* SHAMapItem::getData is not needed
* SHAMapTreeNode::getItem is not needed
* SHAMapTreeNode::getData is not needed
* No need to copy them when constructing transactions
* No need to copy them when computing map deltas
* No need to copy them in deepCompare
* No need to copy them in SHAMapTreeNode's copy constructor
2014-01-07 15:57:48 -08:00
JoelKatz
045beb5f36 Concurrent SHAMap code
Use shared lock for SHAMap itself and concurrent map for nodes
2014-01-07 15:57:47 -08:00
JoelKatz
cd8234acba Pathfinding bugfix. Missing lock. 2014-01-07 15:57:46 -08:00
JoelKatz
de85a7c2bd Pathfinding improvements:
* Make each path request track whether it needs updating.
* Improve new request handling, reverse order for processing requests.
* Break to handle new requests immediately.
* Make mPathFindThread an integer rather than a bool. Allow two threads.
* For old pathfinding, if the ledger is unspecified, use the PathRequest's RippleLineCache.
* Log new pathfinding request latencies.
* Suspend processing requests if server is backed up.
2014-01-07 15:57:46 -08:00
Vinnie Falco
087301933a General refactoring, using C++11
* Remove broken RecycledObjectPool

* Fix beast::ServiceQueue using List instead of LockFreeStack

* Add class semaphore, fixes broken Semaphore

* Move crytpo module files to new beast directory

* Use c++11 replacements for boost and beast types:
  - std::atomic instead of beast::Atomic
  - std::function instead of boost::function, beast::function
  - std::unique_ptr instead of beast::ScopedPointer
  - std::shared_ptr instead of boost::shared_ptr

* Remove modules:
  - beast_db
  - beast_crypto
  - beast_extras

* Remove unnecessary classes:
  - AbstractFifo
  - AddConst
  - AtomicCounter
  - AtomicFlag
  - AtomicPointer
  - AtomicState
  - CopyConst
  - Expression
  - ForwardList
  - IfCond
  - Interval
  - IntrusiveArray
  - KeyvaDB
  - PointerToOther
  - PointerTraits
  - RemoveConst
  - RemoveConstVolatile
  - RemoveReference
  - RemoveVolatile
  - SharedObjectArray
  - SingleThreadedSharedObject
  - SophiaDB factory
  - SortedSet
  - WeakReference
  - beast::unique_ptr
2014-01-07 15:57:45 -08:00
JoelKatz
52333b8bd4 Fix a compiler warning in Ledger::visitStateItems 2014-01-07 15:48:50 -08:00
JoelKatz
3768b3c3ca Fix a pathfinding bug 2014-01-07 15:48:50 -08:00
JoelKatz
09b39e107d Fix subscribing to "real time" transactions. 2014-01-07 15:48:49 -08:00
Vinnie Falco
4b1155bf32 Improved diagnostic for RocksDB error codes
Conflicts:
	Builds/VisualStudio2012/RippleD.vcxproj.filters
2014-01-07 15:46:38 -08:00
Vinnie Falco
3c7fc31c95 Add ripple_common module
Conflicts:
	Builds/VisualStudio2012/RippleD.vcxproj.filters
2014-01-07 15:15:44 -08:00
Nicholas Dudfield
da3881a486 Make websocket-test the first test, and give custom timeouts of 1000ms 2014-01-05 13:40:47 +07:00
Nicholas Dudfield
ff12d9adaa Run server-test and websocket-test first. Show stderr upon abnormal rippled exit 2014-01-05 13:09:42 +07:00
Vinnie Falco
528cf56f80 Reduce StatsDCollector log verbosity 2014-01-02 19:32:27 -08:00
Vinnie Falco
0ebe3f1f35 Disable NameResolver temporarily 2014-01-02 16:12:55 -08:00
Vinnie Falco
328680b6cd Fix Resolver contract check 2014-01-02 16:10:49 -08:00
Vinnie Falco
f9dca105a6 Improved async stop for Resolver
Conflicts:
	src/ripple_app/peers/NameResolver.cpp
2014-01-02 15:38:03 -08:00
Vinnie Falco
3664db61e7 Fix static storage duration issue with some Journal logs 2014-01-02 15:21:33 -08:00
Vinnie Falco
49677aa799 Fix RippleBookType and unit tests 2013-12-29 11:33:50 -08:00
NATTSiM
27b771e2ba Fix clang compile 2013-12-27 17:46:51 -08:00
Vinnie Falco
6527cdfa97 Add RippleAsset types
Conflicts:
	Builds/VisualStudio2012/RippleD.vcxproj.filters
2013-12-27 17:21:11 -08:00
JoelKatz
b2dbe8ef83 Ledger acquire fixes/cleanups/logging
* Inbound ledger and SHAMapAddNode cleanup
    * Log acquire stats
    * Fix progress logic
    * Remove ledgers we no longer need to acquire
    * Stash stale state data in our fetch pack, it can still be useful
    * Stash in fetch pack if acquire terminated while job was pending
    * Account for duplicate/invalid nodes in a few cases previously missed
    * Dispatch each InboundLedger once (not per data)
    * Trigger only the "best" peer
    * Don't call tryAdvance on failed acquires
2013-12-27 16:48:03 -08:00
NATTSiM
9bdb0774ad Make InboundLedgers, LedgerConsensus abstract 2013-12-27 16:48:03 -08:00
Vinnie Falco
8c2ec2cfbe Add AbstractObject, cyclic_iterator, Journal improvements 2013-12-27 16:47:43 -08:00
Wolfgang Spraul
00f959ab7e removed boost_random 2013-12-26 14:31:22 -08:00
Vinnie Falco
f9c4070ad3 Add FetchPack unit test 2013-12-22 12:57:44 -08:00
Vinnie Falco
074325a7ea Inject SHAMap missing node handler dependency 2013-12-22 12:38:07 -08:00
JoelKatz
2f521a6a91 Build fetch packs correctly. 2013-12-22 12:38:07 -08:00
sublimator
07959b3cc9 Allow to full network limit in Amount::isLegalNet 2013-12-20 15:44:03 -08:00
The Doctor
21faf8eaeb Improvements to initscript and default configuration.
* Added absolute paths to the [node_db] and [debug_logfile] stanzas in the config file.

* Changed some tabs into spaces for consistency.

* Added directory tree sanity checking to initscript.

Signed-off-by: The Doctor <drwho@virtadpt.net>
2013-12-20 15:38:30 -08:00
Nik Bougalis
3e2b5dcc3d Hostname resolution support for Peers 2013-12-19 14:50:03 -08:00
Nik Bougalis
88a8433d31 Add reference counting to AsyncObject 2013-12-19 14:39:26 -08:00
Vinnie Falco
81d418007a Add CollectorManager for Beast.Insight support 2013-12-16 18:08:11 -08:00
Vinnie Falco
f88fcf55a3 Add Beast.Insight stats collection module 2013-12-16 12:22:25 -08:00
Vinnie Falco
561c8dea08 Add stl module for c++11 compatibility classes 2013-12-16 11:35:21 -08:00
David Schwartz
de92ac9e0b Websocket improvements:
* Log on_close/on_fail/on_open calls.
* Ping out connections.
* Improve ping logic.
* On websocket ping out, close abnormally.
* Avoid deadlock when shutting down websocket endpoint
2013-12-16 09:40:15 -08:00
JoelKatz
deead04a6a getFetchPack fixes, spread fetch pack requests. 2013-12-15 07:20:24 -08:00
JoelKatz
d4771a9b36 Fix missing call to setPubLedger on gap in published ledger stream. 2013-12-13 11:14:34 -08:00
JoelKatz
27b8415d0c During old pathfinding, unlock earlier. 2013-12-12 21:17:25 -08:00
David Schwartz
e1e81e5d97 Call pendSaveValidated without holding the ledger master lock 2013-12-12 21:17:20 -08:00
Vinnie Falco
3705680d68 Disable RocksDB for older compilers 2013-12-10 11:23:06 -08:00
Vinnie Falco
a01f546ae3 Use ScopedPointer instead of deprecated auto_ptr 2013-12-10 14:14:15 -05:00
Bryce Lynch
eabc905bac Add Debian-style initscript
* Add validators and validation_quorum from the v0.16 release notes.
* We keep having to tell people to do this during integration, let's just make it the default.
* Add comment about the log file location that states that it has to be absolute rather than relative after an integration troubleshoot earlier today.

Signed-off-by: Bryce Lynch <bryce@ripple.com>
2013-12-09 16:21:22 -08:00
JoelKatz
37588b6808 Avoid an extraneous test. 2013-12-09 00:52:40 -08:00
JoelKatz
071db75f04 Add a 1 MB payload limit to incoming websocket requests 2013-12-09 00:52:40 -08:00
David Schwartz
1e00940a90 Move some ledger cleaner helper functions into the ledger master. 2013-12-08 23:53:57 -08:00
JoelKatz
b984566480 Suppress a warning. 2013-12-08 23:53:47 -08:00
JoelKatz
51aef120a1 Pathfinding performance improvements:
* Use a single RippleLineCache, even for 'fast' requests
* Use a ledger copy to avoid stalling other code
2013-12-08 23:52:54 -08:00
JoelKatz
636d722e8d Memory-conserving changes to SHAMapTreeNode and visitLeavesInternal. 2013-12-08 23:52:54 -08:00
Vinnie Falco
e6da61120a Make AbstractObject unit test manual 2013-12-06 09:57:03 -08:00
JoelKatz
b901e0dcf3 Fix load stats in get_info 2013-12-05 22:04:42 -08:00
Vinnie Falco
177b3c93c4 Move DecayingSample to algorithm 2013-12-05 18:35:37 -08:00
JoelKatz
9996e4a57e The new recommended fee schedule is:
* Transaction fee: 10 drops
* Base reserve: 20 XRP
* Incremental reserve: 5 XRP
2013-12-04 19:07:58 -08:00
JoelKatz
4751b6a65c Fix for issue 211, fixes to NetworkOPs getTxsAccountB 2013-12-04 17:09:22 -08:00
David Schwartz
b3c79f5c2f Change visitLeaves to visit a snapshot so the ledger stays unlocked 2013-12-04 11:10:27 -08:00
David Schwartz
0e53105ab5 Remove dead code and fix a race condition in the node back end.
Race was between a store and a fetch, as follows:
1) Fetch: Search for the node, it is not found.
2) Store: Add the node to the database, remove the node from the negative cache.
3) Fetch: Add the node to the negative cache.
This would leave a node in the DB, cache, and negative cache.
2013-12-04 11:10:22 -08:00
Vinnie Falco
0f2a657196 Add double conversion for PropertyStream map items 2013-11-30 17:56:25 -08:00
Vinnie Falco
89aa2c7a6a Refactor some Journal::Sink members 2013-11-30 17:32:50 -08:00
Vinnie Falco
4c843b6c66 IPAddress fixes and algorithm comparison functors 2013-11-30 09:21:46 -08:00
Vinnie Falco
130c7c5c58 Refactor and fix some object arithmetic comparisons 2013-11-30 06:28:29 -08:00
Vinnie Falco
76c364ec2d Add const now() 2013-11-30 01:42:38 -08:00
Vinnie Falco
a549c94a15 Fix missing assert in UnitTest runner 2013-11-30 01:42:37 -08:00
Vinnie Falco
6de8a6907f Add AbstractObject 2013-11-30 01:42:37 -08:00
Vinnie Falco
fc31562052 Tidy doc comments 2013-11-29 23:44:36 -08:00
Vinnie Falco
cdaa65c07a Remove LightningDB database and backend 2013-11-27 15:14:21 -08:00
Vinnie Falco
8a278cf9d6 Remove sophia database and backend 2013-11-27 15:09:26 -08:00
Vinnie Falco
97cecc18ce Set version to 0.19.2 2013-11-27 13:10:19 -08:00
JoelKatz
536db23e14 Fix foundResume check in account_tx 2013-11-27 12:25:45 -08:00
Vinnie Falco
39d801fb9f Merge branch 'release' into develop 2013-11-27 10:00:34 -08:00
Vinnie Falco
6d707b21b2 Set version to 0.19.1 2013-11-27 09:54:41 -08:00
JoelKatz
2316fe5bbe A better way to return an empty set if the token isn't an object. 2013-11-27 09:11:42 -08:00
JoelKatz
16ec9d2bdb Return an empty set if token is not an object 2013-11-27 08:54:49 -08:00
JoelKatz
2ce4ce4309 Begin deprecating the old account_tx interface. 2013-11-26 22:01:10 -08:00
JoelKatz
858c3a5362 Force NDEBUG in sqlite, RocksDB, and HyperLevelDB by default 2013-11-26 21:59:35 -08:00
JoelKatz
c124ad0dcd Add BEAST_SQLITE_FORCE_NDEBUG option 2013-11-26 21:56:17 -08:00
JoelKatz
ed64c8bb29 Add LedgerCleaner:
* Manually invoked to clean ledgers
* Get status with: 'print app.ledgercleaner.*'
* Invoke or control with 'ledger_cleaner' command
2013-11-26 21:50:35 -08:00
Vinnie Falco
2678360715 Set version to 0.19.0 2013-11-22 23:39:12 -08:00
JoelKatz
54e504dd5a Make --import work 2013-11-22 23:39:07 -08:00
JoelKatz
b632a6b2cf If the RocksDB base file size is changed, change the write cache and L0 size to match 2013-11-22 23:39:02 -08:00
Vinnie Falco
b9e2ac38fa Set version to 0.19.0 2013-11-22 23:36:50 -08:00
JoelKatz
4d1c2a5798 Make --import work 2013-11-22 18:01:13 -08:00
JoelKatz
c69d8a13b3 If the RocksDB base file size is changed, change the write cache and L0 size to match 2013-11-22 16:13:12 -08:00
Vinnie Falco
7c358cda17 Set version to 0.18.0 2013-11-22 15:57:59 -08:00
Vinnie Falco
1954a0eb2e Set version to 0.18.0 2013-11-22 15:57:41 -08:00
Vinnie Falco
5500701661 Fix Workers thread name 2013-11-22 15:51:20 -08:00
Vinnie Falco
21918922f4 Set background thread name 2013-11-22 15:51:20 -08:00
Vinnie Falco
fad52c5917 Comment out write to stdout 2013-11-22 15:51:20 -08:00
Vinnie Falco
306811d2a7 Add RocksDB NodeStore backend 2013-11-22 15:51:19 -08:00
Vinnie Falco
8b72f2ad79 Add rocksdb module 2013-11-21 18:31:15 -08:00
Vinnie Falco
1a1cb696f7 Make include paths relative 2013-11-21 16:59:54 -08:00
Vinnie Falco
582c17b06b Merge commit 'b156a49cff152fd52992a4823aaeafbaf70e564e' as 'src/ripple/rocksdb/rocksdb' 2013-11-21 16:24:10 -08:00
Vinnie Falco
b156a49cff Squashed 'src/ripple/rocksdb/rocksdb/' content from commit 56589ab
git-subtree-dir: src/ripple/rocksdb/rocksdb
git-subtree-split: 56589ab81f
2013-11-21 16:24:10 -08:00
Vinnie Falco
3943cfea06 Fix LevelDB Windows port 2013-11-21 15:00:57 -08:00
David Grogan
97346c6618 Upgrade LevelDB from 1.12 to 1.14:
* Fix issues 77, 87, 182, 190, 200, and 201

* Fix bug described in https://groups.google.com/d/msg/leveldb/yL6h1mAOc20/vLU64RylIdMJ

* Fix a bug where options.max_open_files was not getting clamped properly.

* Fix link to bigtable paper in docs.

* New sstables will have the file extension .ldb. .sst files will continue to be recognized.
2013-11-21 12:59:46 -08:00
JoelKatz
474b824902 Don't throw away an initial error when detecting the handshake. 2013-11-20 17:01:21 -08:00
David Schwartz
02b5572ccc Changes to support the ledger cleaner
* Rework ledger save return values to indicate errors to callers
* Add an extra function to support the ledger cleaner.
2013-11-20 12:22:45 -08:00
Vinnie Falco
4577ad60c7 Fix ResourceManager log output 2013-11-20 11:31:19 -08:00
JoelKatz
e683c380e5 Fix a defect in RangeSet. 2013-11-20 11:31:14 -08:00
Vinnie Falco
b660d82516 Make TxFormats a Meyers singleton 2013-11-20 10:16:46 -08:00
Nicholas Dudfield
c0dda06499 Parse STArray correctly in STObject::parseJson 2013-11-20 08:54:59 -08:00
Vinnie Falco
65abd6307d Update hyperleveldb module 2013-11-19 11:33:09 -08:00
Vinnie Falco
6e713dc3b8 Merge commit '596a35accad6e838e05180e79c1ea626eaf93a34' into develop 2013-11-19 11:32:55 -08:00
Vinnie Falco
596a35acca Squashed 'src/hyperleveldb/' changes from ac2ae30..25511b7
25511b7 Merge branch 'master' of github.com:rescrv/HyperLevelDB into hyperdb
ed01020 Make "source" universal
3784d92 Ignore the static file
507319b Don't package with snappy
3e2cc8b Tolerate -fno-rtti
4dcdd6e Drop revision down to 1.0.dev
2542163 Drop all but the latest kept for garbage reasons
9c270b7 Update .gitignore
5331878 Add upack script
adc2a7a Explicitly add -lpthread for Ubuntu
7b57bbd Strip NULL chars passed to LiveBackup
e3b87e7 Add write-buffer-size option to benchmark
2f11087 Followup to snappy support with -DSNAPPY
af503da Improve efficiency of ReplayIterator; fix a bug
33c1f0c Add snappy support
ce1cacf Fix a race in ReplayIterator
5c4679b Fix a bug in the replay_iterator
ca332bd Fix sort algorithm used for compaction boundaries.
d9ec544 make checK
b83a9cd Fix a deadlock in the ReplayIterator dtor
273547b Fix a double-delete in ReplayIterator
3377c7a Add "all" to set of special timestamps
387f43a Timestamp comparison and validation.
f9a6eb1 make distcheck
9a4d0b7 Add a ReplayIterator.
1d53869 Conditionally enable read-driven compaction.
f6fa561 16% end-to-end performance improvement from the skiplist
28ffd32 Merge remote-tracking branch 'upstream/master'
a58de73 Revert "Remove read-driven compactions."
e19fc0c Fix upstream issue 200
748539c LevelDB 1.13
78b7812 Add install instructions to README
e47a48e Make benchmark dir variable
820a096 Update distributed files.
486ca7f Live backup of LevelDB instances
6579884 Put a reference counter on log_/logfile_
3075253 Update internal benchmark.
2a6b0bd Make the Version a parameter of PickCompaction
5bd76dc Release leveldb 1.12

git-subtree-dir: src/hyperleveldb
git-subtree-split: 25511b7a9101b0bafb57349d2194ba80ccbf7bc3
2013-11-19 11:32:55 -08:00
Vinnie Falco
4ad84a339f Make LedgerMaster abstract 2013-11-18 15:04:17 -08:00
JoelKatz
833435f8c2 The 'ledger' RPC command should be considered high burden if 'full' is set. 2013-11-17 20:11:40 -08:00
JoelKatz
4e4942e357 Fix break logic in STObject::parseJson for arrays. 2013-11-16 18:57:08 -08:00
JoelKatz
1fc8f0a33b Missing break in STObject::parseJson for arrays. 2013-11-16 18:56:01 -08:00
Vinnie Falco
1f433dea97 Add ripple_app TODO 2013-11-15 18:39:07 -08:00
Vinnie Falco
d8707cad2c Refactor logging 2013-11-15 13:25:56 -08:00
Vinnie Falco
a399b571ac Journal API improvements 2013-11-15 12:30:01 -08:00
Vinnie Falco
d0e71225c4 Fix severity check on ~ScopedStream 2013-11-15 11:29:45 -08:00
Vinnie Falco
19d4bf0ea5 Add README and tidy up comments 2013-11-15 11:29:45 -08:00
Vinnie Falco
9e519af887 Add missing README and TODO for all new modules 2013-11-15 11:27:26 -08:00
JoelKatz
29aa462bfd Add more comments to the consensus code. 2013-11-14 22:41:34 -08:00
JoelKatz
7a91872ee5 Fix broken indentation around BOOST_FOREACH 2013-11-14 22:35:09 -08:00
JoelKatz
68307d1012 Functions like remote_endpoint().address() can throw 2013-11-14 11:20:35 -08:00
JoelKatz
48cb707bb6 Handle a missing ledger node discovered during pathfinding. 2013-11-14 11:20:16 -08:00
JoelKatz
9322233b37 Allow the SHAMap visitLeaves functions to sanely handle a missing map node. 2013-11-13 11:04:17 -08:00
JoelKatz
1daf1b9932 Use MultiSocket for websocket 2013-11-12 21:09:01 -08:00
JoelKatz
a3024352ba Pathfinding improvements. 2013-11-12 21:08:52 -08:00
David Schwartz
58f07a573f New ResourceManager for managing server load.
* Track abusive endpoints
* Gossip across cluster.
* Use resource manager's gossip support to share load reporting across a cluster
* Swtich from legacy fees to new Resource::Charge fees.
* Connect RPC to the new resource manager.
* Set load levels where needed in RPC/websocket commands.
* Disconnect abusive peer endpoints.
* Don't start conversations with abusive peer endpoints.
* Move Resource::Consumer to InfoSub and remove LoadSource
* Remove port from inbound Consumer keys
* Add details in getJson
* Fix doAccountCurrencies for the new resource manager.
2013-11-12 21:08:52 -08:00
Vinnie Falco
a05f33f6a7 Add annotation and clean up whitespace 2013-11-12 19:30:07 -08:00
Vinnie Falco
968624971f Add TestOverlay README 2013-11-12 09:18:11 -08:00
JoelKatz
57e77a5bd2 Use Ledger::visitStateItems to implement OrderBookDB::update 2013-11-11 21:31:18 -08:00
JoelKatz
74c65cfdc5 Cleanup path request logging. 2013-11-11 19:29:56 -08:00
JoelKatz
399760fda9 Assign each path finding request an ID and track its lifecycle. 2013-11-11 18:32:45 -08:00
Vinnie Falco
67b8f95b1e Add PeerFinder README doc 2013-11-10 15:51:29 -08:00
Vinnie Falco
d4d6acdf68 Add MSVC Output window Journal config setting
Conflicts:
	src/ripple/peerfinder/impl/Manager.cpp
	src/ripple/validators/impl/Manager.cpp
2013-11-10 15:06:05 -08:00
Vinnie Falco
472baa8bac Update README 2013-11-10 10:42:07 -08:00
Vinnie Falco
dd74c19858 Tidy up LoadMonitor stats API 2013-11-09 12:08:23 -08:00
Vinnie Falco
b5f8d447a0 Tidy up Resource::Manager APIs 2013-11-09 12:00:37 -08:00
JoelKatz
5f4a1917a6 Change how cluster load is computed from average-ish to median-ish. 2013-11-08 11:05:43 -08:00
JoelKatz
cf71680aee Don't return too many paths. 2013-11-08 11:05:05 -08:00
JoelKatz
f04b9131cc terNO_LINE should never be the final result of a payment transaction that can claim a fee. 2013-11-08 10:32:15 -08:00
JoelKatz
46861fac48 Don't allow a payment to take anything from an expired offer. 2013-11-08 10:17:12 -08:00
JoelKatz
4620b667e7 Fix a race condition if PathRequest::doCreate races with the path being processed. 2013-11-07 22:30:11 -08:00
Vinnie Falco
49f43ccc0a Set version to 0.17.0-rc5 2013-11-07 10:30:50 -08:00
Vinnie Falco
63aa7284c4 Disable peerfinder hooks 2013-11-07 09:59:28 -08:00
Patrick Dehne
286ade2d17 Beast improvements and vflib compatibility module work
* Add CallQueue vflib compatibility class
* Use run instead of run_one
* Merge BindableServiceQueue into CallQueue
* Take BEAST_VARIADIC_MAX into account
* Fix license headers as suggested by Vinnie
* Remove obsolete comment
* Add ManualServiceQueue
* Add ManualServiceQueue to beast_vflib include
* Move static unit test variables of header only classes to module cpp
* Remove no longer used mutex member
* _VARIADIC_MAX maxes out at 10
* Correctly apply BEAST_VARIADIC_MAX
* Merge BindableServiceQueue into CallQueue
* New GuiServiceQueue and its JUCE dependency
* Fix leftover merge errors
* Fix CallQueue unit test
* Don't use bassert for better CI support
2013-11-07 09:42:37 -08:00
Vinnie Falco
066d92ecfa Improve MultiSocket::ssl_handle 2013-11-07 09:35:04 -08:00
Vinnie Falco
c5ccabec38 Fix to use IPS from config 2013-11-06 06:19:06 -08:00
Vinnie Falco
548fedb859 Fix missing cstdlib 2013-11-06 06:19:02 -08:00
Nicholas Dudfield
8d5378a2ca Ensure no offers cancel each other out 2013-11-05 23:20:45 -08:00
David Schwartz
bf1843be9e Add "account_currencies" command. 2013-11-05 16:07:17 -08:00
David Schwartz
d50439cc4d doAccountLines cleanup. 2013-11-05 15:41:15 -08:00
Vinnie Falco
6a8f313394 Set version to 0.17.0-rc4 2013-11-05 14:41:49 -08:00
David Schwartz
c211094d3e Allow two trust lines to be created without reserve check. 2013-11-05 13:29:07 -08:00
Vinnie Falco
072b4f3b73 Set version to 0.17.0-rc3 2013-11-05 11:22:20 -08:00
Vinnie Falco
08cbcba4ee Fix warning 2013-11-05 03:23:15 -08:00
Vinnie Falco
2a9171c623 Improve hasher for IPAddress 2013-11-05 03:15:09 -08:00
Vinnie Falco
8573679fbb Fix compile error 2013-11-05 03:09:39 -08:00
Vinnie Falco
811f244fc2 Set boolalpha for Journal::ScopedStream 2013-11-05 03:09:39 -08:00
Vinnie Falco
a31b2556a3 Add ostream support for PropertyStream items 2013-11-05 03:09:39 -08:00
Vinnie Falco
a0ad5cdbfe Add to_string for asio endpoints 2013-11-05 03:09:39 -08:00
Nicholas Dudfield
59cf668348 Fix IPAddress::V4::Proxy 2013-11-05 03:02:20 -08:00
Stefan Thomas
09acc26c50 Fix marker being set for last result. 2013-11-03 22:39:55 -08:00
JoelKatz
0ae7bcff52 Fix the path filtering loop exit condition. 2013-11-03 17:20:10 -08:00
JoelKatz
2210dbac94 Don't abort the path filtering loop too early. 2013-11-03 16:37:35 -08:00
JoelKatz
6b2f654a30 Improve path filtering:
1) Ignore paths with very low liquidity
2) Allow an extra filling path to be added if needed
2013-11-03 02:20:18 -08:00
Vinnie Falco
3296ac5628 Turn off test URL in SiteFiles 2013-11-01 16:10:25 -07:00
Vinnie Falco
6d06cb29df Block until thread exits in manager dtors 2013-11-01 15:48:37 -07:00
Vinnie Falco
b08c7d15cd Stoppable, make stop() require call to start() 2013-11-01 13:31:38 -07:00
Vinnie Falco
940d620a96 Fix SiteFiles thread name 2013-11-01 10:34:35 -07:00
Vinnie Falco
a39fa8ae5f New SiteFiles for fetching and managing ripple.txt files 2013-10-31 08:10:06 -07:00
Vinnie Falco
f859bf160a Improve URL string conversions and ostream support 2013-10-31 08:10:06 -07:00
Vinnie Falco
e0512930ae Fix error parameter in HTTPClient logic 2013-10-31 08:10:06 -07:00
Vinnie Falco
7bbf6c553f Move ServiceQueueBase out of detail namespace 2013-10-31 08:10:05 -07:00
Vinnie Falco
aeb335ebdc Add hash function to URL 2013-10-31 08:10:05 -07:00
Vinnie Falco
73ab408b3c Move MurmurHash to beast 2013-10-31 08:10:04 -07:00
Vinnie Falco
f333a33f3d Make ServiceQueue::enqueue virtual 2013-10-31 08:10:04 -07:00
Nik Bougalis
42b841735e PeerFinder work 2013-10-29 20:52:57 -07:00
Vinnie Falco
e710bd2183 Use IPAddressConversion 2013-10-29 20:52:57 -07:00
Vinnie Falco
84556ba76a Add Bootstrap Strategy exposition 2013-10-29 20:52:56 -07:00
David Schwartz
4eebea91d3 DecayingSample::decay must always return with the time current. 2013-10-29 14:46:22 -07:00
JoelKatz
4ddadb8792 Correctly compute amount left on sell offer when a crossing offer pays us more than we asked for. 2013-10-28 16:48:47 -07:00
JoelKatz
8e65d6288d Fix limit calculation. 2013-10-28 07:24:01 -07:00
Justin Lynn
8e18deb74f disable e-mail notifications for travisCI 2013-10-25 17:48:20 -07:00
Justin Lynn
7ae1ad524b Merge branch 'develop' of github.com:ripple/rippled into develop 2013-10-24 19:11:17 -07:00
Justin Lynn
1ba1b3983a travis installs exuberant-ctags 2013-10-24 19:11:08 -07:00
Nicholas Dudfield
aabd6980ac Fix a bug in websocket-test.js referencing done() not declared in test() function signature, was causing failure of subsequent test suite, due to mocha's enveloped exception handling style 2013-10-24 19:03:03 -07:00
Nicholas Dudfield
3b19310252 Declarative path tests 2013-10-24 19:03:03 -07:00
Justin Lynn
8201805b28 explicitly use libboost 1.48 2013-10-24 18:53:38 -07:00
Justin Lynn
7277c8478b install dependencies when running travis ci 2013-10-24 18:47:18 -07:00
Justin Lynn
963a0dd934 initial travis yml file 2013-10-24 18:40:07 -07:00
JoelKatz
3108d58791 Fix typo. 2013-10-24 16:57:27 -07:00
Patrick Dehne
31b1a6a7e6 Add beast_vflib compatibility module and stand alone unit test app 2013-10-23 17:37:00 -07:00
JoelKatz
9ff65d0da4 Fix setting the no ripple flag when a trust line is created. 2013-10-23 17:24:34 -07:00
JoelKatz
c11abb42d1 Fix a case where 'sign' won't work in standalone mode. 2013-10-23 17:24:16 -07:00
Vinnie Falco
7b6d81d812 Measure CPU usage in Workers 2013-10-22 17:23:54 -07:00
Vinnie Falco
ca0daad11f Update notes 2013-10-22 12:59:56 -07:00
Vinnie Falco
a0c4e685c5 Add local_endpoint and remote_endpoint to MultiSocket 2013-10-22 12:33:11 -07:00
Nik Bougalis
b30f7a622c Set PEERS_MAX default value 2013-10-22 11:48:43 -07:00
Vinnie Falco
23f44f12bd Add IPAddressConversion and asio module 2013-10-22 11:45:30 -07:00
Nik Bougalis
6c17002e8a Peerfinder work 2013-10-22 10:43:17 -07:00
Vinnie Falco
5dda088335 Peerfinder work 2013-10-22 10:43:16 -07:00
Vinnie Falco
2427cce2c8 Rename to IPAddress and remove unused files 2013-10-22 10:43:16 -07:00
Nik Bougalis
1c41dae51c PeerFinder work 2013-10-22 10:43:15 -07:00
Vinnie Falco
1a6d72b14c Squelch spurious linker warning 2013-10-22 10:43:15 -07:00
Vinnie Falco
3dc646e03e Use serialized Context wrapper in Validators 2013-10-22 10:43:14 -07:00
Vinnie Falco
96328a8632 Add FixedPeers connection policy to peerfinder 2013-10-22 10:43:14 -07:00
Vinnie Falco
2cc4488d8e Fix crash in PropertyStream::find 2013-10-22 10:13:46 -07:00
wltsmrz
a6c2fe4761 Remove coffeescript compiler from mocha.opts until it is needed and added to dependencies 2013-10-21 17:54:36 -07:00
JoelKatz
ed905d3c3d Remove redundant code. 2013-10-21 15:06:05 -07:00
Vinnie Falco
81eadbd05c RelativeTime tidying 2013-10-20 15:31:50 -07:00
Patrick Dehne
ef1e2f8595 monotonicCurrentTimeInSeconds should return seconds, not milliseconds 2013-10-21 00:11:44 +02:00
Patrick Dehne
fae7082049 Wrap hiResCounterHandler in a function to prevent an order of initialization problems 2013-10-20 23:38:52 +02:00
Patrick Dehne
a63de23156 Rename millisecondsSinceStartup to monotonicCurrentTimeInSeconds 2013-10-20 23:37:24 +02:00
Patrick Dehne
8e0dda8480 #ifdef unneeded sys/prctl.h include in the mac build 2013-10-20 01:43:24 +02:00
Patrick Dehne
ad7b9ff8b5 Make fromStartup compile on mac 2013-10-20 01:38:59 +02:00
Vinnie Falco
04f2d0787a Merge commit '2ad98a025eb263d97b1942fc468937b4719becd8' into develop
Conflicts:
	src/beast/beast/utility/PropertyStream.h
	src/beast/beast/utility/impl/PropertyStream.cpp
	src/beast/modules/beast_sqlite/beast_sqlite.h
2013-10-19 15:57:15 -07:00
Vinnie Falco
2ad98a025e Squashed 'src/beast/' changes from 43e6d34..0e7bac9
0e7bac9 Fix include path
e5bb90f Fix constness of Proxy
ac0142a Use template cast
ef6e381 Add missing Url.h include
206e65c Fix constness of operator[]
695cc38 Use template instantiation for friend declaration
7b1e03a Add BaseFromMember
49bc04f Make List<>::Node not uncopyable
d5954ff Add Journal to UnitTest
58da106 Temporarily disable ServiceQueue dtor precondition asserts
fe58c1a Add missing #include
2c02580 Add PropertyStream for server state introspection
24c2315 Add ScopedWrapperContext
a3845f5 Add RelativeTime::value_type typedef
7442932 Fix missing PropertyStream members
ed5a98f More PropertyStream output for PeerFinder
fcfa10d Add PropertyStream
3cf0729 Tidy up AbstractHandler usage in HTTPClient
55171f4 Remove obsolete source files
1311ca3 Increase arity of SharedFunction
67d807d Add IPEndpoint::key_equal
ebf395e Add ErrorCode and boost library
2c3ead3 Add ServiceQueue::wrap
6c7f5d0 Move many Thread related classes
93e9d86 Measure CPU utilization in ServiceQueue
ca47d72 Move ServiceQueue, ThreadLocalValue, SpinLock
c864e4d Move WaitableEvent
ff305e6 Add CPUMeter and ScopedTimeInterval
01fd05c Add RecursiveMutex, UnlockGuard, TryLockGuard
5831a53 Remove Journal from most Stoppable overrides
b60a7f3 Add Request and Response HTTP parsers
44445ff Refactor net buffers classes
ac37c38 Beast class refactor
8b7056b Fix eof on HTTP client get
228b664 Remove obsolete beast container classes
1dfd655 Use RelativeTime from startup in DeadlineTimer
ae22d5d Add more methods to RelativeTime
c67929e Remove unhandled exception catcher
2472a90 Add 64 bit output for MurmurHash
f3d97c7 Add RelativeTime::fromStartup
b0b8660 IPEndpoint better parsing
ae551cd Add alternate form string parsing to IPEndpoint
d0a0dbf Don't break on Throw
0e46762 Add hasher functors for IPEndpoint
a1ec423 Add Thread::stopThreadAsync
4f7dca3 Add compiler, stdlib, and platform skeleton to beast/config
4394594 Tidy up some use of Error for throw
e5e0f52 Journal console output improvements
f07515e Add Stoppable prepare and start interfaces
d37dd46 Move RelativeTime to chrono, add ostream support
3f6e7aa Add console feature to Journal
ad0064a Journal option to write to Output window (MSVC)
0b7574b Add compilation test script
cc05ce1 Add ServiceQueue
e132aab Use boost for functional when the config is set
026b926 Fix is_continuation for boost version
c807a4e Fix invoked_type type reference
2ff781b Remove LockFreeStack::size
3acb474 Add SharedData::ConstAccess
7e4c834 Add LockFreeStack::empty
9c61a6d Added AbstractHandler, WrapHandler. HTTPClient Fixes.
94e40dc Fix unittest, by removing recursive call.
38bf408 Fix nonstandard C++ extension in getNullSink
1ef044d Build fixes
d5d3746 Fix missing <cmath> include for Gentoo
5f231d3 Update copyright notice and licenses
7b89bf6 Add FixedArray, IntrusiveArray, Crypto
5c5de57 Reorganize beast modules and files
9e18bb3 Merge commit '43deaaa5cf0d0178a4a6c3cb69c02a2a9a43ec7d' as 'src/beast/beast/http/impl/http-parser'
57703ac Fix BeforeBoost.h include
fbc247b Add Stoppable to beast
56496d8 IPEndpoint comparisons
9d9c822 Migrate some headers and general tidying
1a3cddc Add SharedArg and AsyncObject
373ca9c Add HTTPRequest and improvements to HTTPMessage parsing
9534516 Add some thread classes and fix SharedData with a simple mutex adapter
755ab36 Make CallQueue unit test runManual
c0ca037 Remove Beast version printing on startup
7efb6a3 Reorganize some MPL and Utility classes and files
69c26a1 Fix missing BeastConfig.h include in Net.cpp
40aa552 Disable Beast version printing in Ripple BeastConfig.h
7b1352d Add InterruptibleThread unit test
68cf759 ThreadWithCallQueue unit test adjustment
6501dea IPEndpoint parsing and tidying
72fc42b Move and add some template metaprogramming classes
2a164f0 Change filname capitalization (end)
6a14f25 Change filename capitalization
92fd417 Move integer types to beast/CStdInt.h
ebbd9ff Move TargetPlatform.h to beast/Config.h
874b524 Add IPEndpoint
14b34fc Tidy up some zlib macro undefines
34fffca Rename beast sources for consistency
4e59ab2 Add CallQueue unit test
327d7a6 Fixes for consolidated beast unity includes
d5ece4e Remove unused and broken classes
39f13be Remove unused ConcurrentObject
37624a7 Add ThreadWithCallQueue unit test
e82ec68 Remove obsolete beast_Function
90551a6 Temporarily leave sqlite3 in whatever threading mode it was already in.
43ebbb1 Fix SharedSingleton to use memoryBarrier
f343941 Tidy up SharedSingleton doc comments
001997e Fix leak on exit from Singleton dependency cycle
83b9d22 Rename to DeadlineTimer::cancel()
77874ee Use new instead of ::new for placement
2a04dcc Journal improvements
50965ca SharedFunction improvements
277e32b Add LockFreeStack iterators
d94e4c2 Fix undefined behavior in UnsignedIntegerCalc (again)
2dc25ce Fix DeadlineTimer, callback while holding lock
207ffde Fix undefined behavior in UnsignedIntegerCalc
1ad8ff9 Fix UnsignedInteger::isZero
1dd2836 Add support for multiprecision integer arithmetic and binary data encoding
a45fc47 Update .gitignore
962a95d Tidy up UnsignedInteger
ca695fa Add Time::isNull()
e96ce99 Better random number facilities in UnitTest
550b8e5 Fine tune UnsignedInteger declaration
8e7e3b7 Allow negative relative expirations in DeadlineTimer
f3dc7ce Add generic Journal class for logging
bfdda32 Make ChildProcess UnitTest manual since it malfunctions
02acf7d General refactoring of beast framework classes
84ef06e Fix ExitHook to derive from AtExitHook
f0acc9c Reduce the max threads in the Workers unit test
55447b0 New SharedSingleton, resolves destruction of objects with static storage duration.
41eb8a1 Remove deprecated SharedPtr::getObject
9eda4bc Make SharedObject members const, the counter mutable
6eda777 Remove deprecated createOnDemandOnce SingletonLifetime option
8c522aa Fix off by one in pending i/o count on HTTPClient
057344e Add HTTPMessage::toString and family
ee728e3 Add UniformResourceLocator::empty
ae324fb Move ./modules to ./src

git-subtree-dir: src/beast
git-subtree-split: 0e7bac945f
2013-10-19 15:54:21 -07:00
JoelKatz
67516766a6 Operations on the raw socket can throw exceptions if it's no longer connected. 2013-10-19 14:14:47 -07:00
Vinnie Falco
3b2ead3476 Turn off console output for msvc logic and managers 2013-10-18 16:29:13 -07:00
Vinnie Falco
fc5be2b911 Use DiscreteClock in ResourceManager 2013-10-18 16:04:37 -07:00
Vinnie Falco
466e623dd6 Add BaseFromMember 2013-10-18 16:04:37 -07:00
Vinnie Falco
a1b487c512 New Resource::Manager for controlling access to server resources 2013-10-18 16:04:31 -07:00
Vinnie Falco
0902af8eb5 Add DiscreteClock and sources 2013-10-17 17:46:23 -07:00
Vinnie Falco
a8a4caf0e4 Make List<>::Node not uncopyable 2013-10-17 17:46:18 -07:00
Vinnie Falco
33478517a6 Add Journal to UnitTest 2013-10-17 17:46:13 -07:00
Vinnie Falco
0d5a8ca300 Revert "Ported declarative path tests to mocha"
This reverts commit abe4f1ba03.
2013-10-17 11:11:06 -07:00
Vinnie Falco
da22f06d85 Revert "Make mocha use test/mocha.opts to DRY up options used by npm test and test/runall.sh and support coffee. Add coffee-script as devDependency to package.json"
This reverts commit 9dfbffa4b8.

Conflicts:

	test/mocha.opts
2013-10-17 11:10:48 -07:00
Vinnie Falco
a918924923 Temporarily disable ServiceQueue dtor precondition asserts 2013-10-16 15:59:04 -07:00
JoelKatz
5a9416fbcf Remove an assert that is not needed. 2013-10-16 13:47:54 -07:00
Vinnie Falco
582b5bb3ac Add --version command line option 2013-10-16 13:29:43 -07:00
Nicholas Dudfield
abe4f1ba03 Ported declarative path tests to mocha 2013-10-13 18:24:41 +07:00
Nicholas Dudfield
9dfbffa4b8 Make mocha use test/mocha.opts to DRY up options used by npm test and test/runall.sh and support coffee. Add coffee-script as devDependency to package.json 2013-10-13 15:38:04 +07:00
Vinnie Falco
a25ba91876 Set version to 0.17.0-rc2 2013-10-11 18:41:45 -07:00
Nik Bougalis
334f109415 Remove extraneous index from peerfinder map. 2013-10-11 18:36:34 -07:00
JoelKatz
eb9eb3aa53 Fix a crash in checkAccept 2013-10-11 16:13:16 -07:00
JoelKatz
978c196c78 Don't assert, just throw. 2013-10-08 15:48:15 -07:00
JoelKatz
20e7cac743 Reduce some logging. 2013-10-08 15:05:41 -07:00
Vinnie Falco
b5d51214ff Add missing #include 2013-10-07 14:26:26 -07:00
Vinnie Falco
485d4b4897 Fix order of includes 2013-10-07 14:24:13 -07:00
Vinnie Falco
fb6ecebbd1 Add PropertyStream for server state introspection 2013-10-07 14:00:03 -07:00
Vinnie Falco
0b69378a03 Update Json::Reader::decodeDouble 2013-10-07 02:49:03 -07:00
Vinnie Falco
256c12f150 Add ScopedWrapperContext 2013-10-06 19:46:42 -07:00
Nik Bougalis
8d0349eee0 Add RelativeTime::value_type typedef 2013-10-06 18:33:53 -07:00
Vinnie Falco
ab0548c9af Fix std::size_t integer ambiguity 2013-10-06 18:33:15 -07:00
Vinnie Falco
4868bc4df7 Validators PropertyStream support 2013-10-06 18:25:59 -07:00
Vinnie Falco
0900dfe46f Fix missing PropertyStream members 2013-10-06 18:25:53 -07:00
Vinnie Falco
8dfe53ff7a More PropertyStream output for PeerFinder 2013-10-06 17:30:45 -07:00
Vinnie Falco
1ae3328642 Add PropertyStream 2013-10-06 17:30:44 -07:00
JoelKatz
b9e0208aee Payment engine doesn't allow returning to XRP. 2013-10-06 15:52:16 -07:00
Vinnie Falco
497cc74adc Set version to 0.17.0-rc1 2013-10-06 11:35:47 -07:00
Vinnie Falco
eac3814fb5 Tidy up AbstractHandler usage in HTTPClient 2013-10-05 15:38:27 -07:00
Vinnie Falco
bb331abeba Remove obsolete source files 2013-10-05 13:08:39 -07:00
Vinnie Falco
6e20bd2dcd Increase arity of SharedFunction 2013-10-05 13:08:39 -07:00
Vinnie Falco
09961845b4 Remove obsolete AsyncService class 2013-10-05 13:08:38 -07:00
Vinnie Falco
7eacd3bf57 Add annotation for Validators 2013-10-05 12:03:51 -07:00
Vinnie Falco
72681fa7fb PeerFinder work 2013-10-05 11:59:17 -07:00
Vinnie Falco
500bddebff Allow CycledSet to grow without bounds 2013-10-05 02:46:23 -07:00
Vinnie Falco
4d3d46f41d Add IPEndpoint::key_equal 2013-10-05 02:41:29 -07:00
Vinnie Falco
82d8d9a092 PeerFinder work, Source fetch, show port in log 2013-10-04 23:22:56 -07:00
Vinnie Falco
30ff139a29 Add ErrorCode and boost library 2013-10-04 23:18:28 -07:00
Vinnie Falco
dc8420d32d LegacyEndpointCache work 2013-10-04 23:18:27 -07:00
Vinnie Falco
bb29c8ba85 Add PeerFinder::Checker for testing endpoints 2013-10-04 23:18:27 -07:00
Vinnie Falco
625780621b Add ServiceQueue::wrap 2013-10-04 23:18:26 -07:00
Vinnie Falco
ea2589dd9c PeerFinder work 2013-10-04 19:25:48 -07:00
Vinnie Falco
942336c454 Move many Thread related classes 2013-10-04 14:34:01 -07:00
Vinnie Falco
90282707ab Measure CPU utilization in ServiceQueue 2013-10-04 14:34:00 -07:00
Vinnie Falco
70f6c41ff7 Move ServiceQueue, ThreadLocalValue, SpinLock 2013-10-04 14:34:00 -07:00
Vinnie Falco
184cf74daa Move WaitableEvent 2013-10-04 14:33:59 -07:00
Vinnie Falco
a23fb06409 Add CPUMeter and ScopedTimeInterval 2013-10-04 14:33:59 -07:00
Vinnie Falco
3638485977 Add RecursiveMutex, UnlockGuard, TryLockGuard 2013-10-04 14:33:59 -07:00
Vinnie Falco
75f3c52d53 Validators work 2013-10-04 14:33:58 -07:00
Vinnie Falco
364973a523 Rename to key_equal for conformance with std containers 2013-10-04 14:33:58 -07:00
Vinnie Falco
678c241962 Validators work 2013-10-04 14:33:57 -07:00
Vinnie Falco
a2aa938e10 Remove Journal from most Stoppable overrides 2013-10-04 14:33:57 -07:00
Vinnie Falco
48eb92e366 Validators work 2013-10-04 14:33:56 -07:00
Vinnie Falco
2894059b63 Fix Peers to stop after children are stopped 2013-10-04 14:33:56 -07:00
Vinnie Falco
66a272debd Alphabet class for base58 conversions, Validators work 2013-10-04 14:33:56 -07:00
Vinnie Falco
7d089561c3 Add Request and Response HTTP parsers 2013-10-04 14:33:55 -07:00
Vinnie Falco
53f8e73b65 Refactor net buffers classes 2013-10-04 14:33:55 -07:00
JoelKatz
37bcf7899e Improve performance of some RPC ledger commands using visitors.
Adds SHAMap::visitLeaves and Ledger::visitStateItems
2013-10-04 11:50:22 -07:00
JoelKatz
86f662aa4a It is not longer necessary to invalidate the OrderBookDB 2013-10-04 02:33:33 -07:00
Vinnie Falco
a1b958eaac Validators update, add LeakChecked to Source subclasses 2013-10-03 19:03:38 -07:00
Vinnie Falco
06189b2584 Disable MSVC OutputWindow for PeerFinder 2013-10-03 19:03:10 -07:00
Vinnie Falco
0bf006cdae Beast class refactor 2013-10-03 19:03:10 -07:00
Vinnie Falco
3f51eb7b63 Fix eof on HTTP client get 2013-10-03 18:36:55 -07:00
Vinnie Falco
b76443dbde Use a simple Thread in SqliteDatabase 2013-10-03 18:36:54 -07:00
Vinnie Falco
5fc823ae08 Show Ripple version in BuildInfo unittest 2013-10-03 18:36:54 -07:00
Vinnie Falco
68aec74b47 Remove obsolete beast container classes 2013-10-03 18:36:53 -07:00
Vinnie Falco
acd23682d1 Use RelativeTime from startup in DeadlineTimer 2013-10-03 18:36:53 -07:00
Vinnie Falco
b042397b9f Add more methods to RelativeTime 2013-10-03 18:36:53 -07:00
David Schwartz
951a8208b8 Don't let OrderBookDB oscillate between two ledgers. 2013-10-03 17:49:38 -07:00
David Schwartz
9b3c74a095 Return the account checked if account_info finds no account. 2013-10-03 16:53:56 -07:00
David Schwartz
647c0e302a Do the tryLocal/addPeers operations on an InboundLedger without the collection lock. 2013-10-03 16:36:33 -07:00
David Schwartz
b3b22d7595 Nothing we do in doTx requires the master lock. 2013-10-03 10:55:42 -07:00
JoelKatz
1ba0139683 Claim saInRemaining. 2013-10-02 16:13:14 -07:00
1471 changed files with 132556 additions and 67629 deletions

53
.travis.yml Normal file
View File

@@ -0,0 +1,53 @@
language: cpp
compiler:
- clang
- gcc
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq python-software-properties
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo add-apt-repository -y ppa:boost-latest/ppa
- sudo apt-get update -qq
- sudo apt-get install -qq g++-4.8
- sudo apt-get install -qq libboost1.55-all-dev
# We want debug symbols for boost as we install gdb later
- sudo apt-get install -qq libboost1.55-dbg
- sudo apt-get install -qq mlocate
- sudo updatedb
- sudo locate libboost | grep /lib | grep -e ".a$"
- sudo apt-get install -qq protobuf-compiler libprotobuf-dev libssl-dev exuberant-ctags
# We need gcc >= 4.8 for some c++11 features
- sudo apt-get install -qq gcc-4.8
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
- sudo update-alternatives --set gcc /usr/bin/gcc-4.8
# Stuff is gold. Nuff said ;)
- sudo apt-get -y install binutils-gold
# We can get a backtrace if the guy crashes
- sudo apt-get -y install gdb
# What versions are we ACTUALLY running?
- g++ -v
- clang -v
script:
# Set so any failing command will abort the build
- set -e
# If only we could do -j12 ;)
- scons
# See what we've actually built
- ldd ./build/rippled
# Run unittests (under gdb)
- | # 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/rippled --unittest
# Run integration tests
- npm install
- npm test
notifications:
email:
false
irc:
channels:
- "chat.freenode.net#ripple-dev"

View File

@@ -45,7 +45,7 @@ linux-g++:QMAKE_CXXFLAGS += \
-pthread
INCLUDEPATH += \
"../../src" \
"../../src/BeastConfig/" \
"../../src/leveldb/" \
"../../src/leveldb/port" \
"../../src/leveldb/include" \
@@ -65,11 +65,13 @@ UI_HEADERS_DIR += ../../src/ripple_basics
SOURCES += \
../../src/ripple/beast/ripple_beast.cpp \
../../src/ripple/beast/ripple_beastc.c \
../../src/ripple/common/ripple_common.cpp \
../../src/ripple/http/ripple_http.cpp \
../../src/ripple/json/ripple_json.cpp \
../../src/ripple/peerfinder/ripple_peerfinder.cpp \
../../src/ripple/rpc/ripple_rpc.cpp \
../../src/ripple/sophia/ripple_sophia.c \
../../src/ripple/radmap/ripple_radmap.cpp \
../../src/ripple/resource/ripple_resource.cpp \
../../src/ripple/sitefiles/ripple_sitefiles.cpp \
../../src/ripple/sslutil/ripple_sslutil.cpp \
../../src/ripple/testoverlay/ripple_testoverlay.cpp \
../../src/ripple/types/ripple_types.cpp \
@@ -93,8 +95,9 @@ SOURCES += \
../../src/ripple_data/ripple_data.cpp \
../../src/ripple_hyperleveldb/ripple_hyperleveldb.cpp \
../../src/ripple_leveldb/ripple_leveldb.cpp \
../../src/ripple_mdb/ripple_mdb.c \
../../src/ripple_net/ripple_net.cpp \
../../src/ripple_overlay/ripple_overlay.cpp \
../../src/ripple_rpc/ripple_rpc.cpp \
../../src/ripple_websocket/ripple_websocket.cpp
LIBS += \

View File

@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros">
<RepoDir>..\..</RepoDir>
<SrcDir>$(RepoDir)\src\cpp\ripple</SrcDir>
</PropertyGroup>
<PropertyGroup>
<OutDir>$(RepoDir)\build\VisualStudio2010\$(Configuration).$(Platform)\</OutDir>
</PropertyGroup>
<PropertyGroup>
<IntDir>$(RepoDir)\build\obj\VisualStudio2010\$(Configuration).$(Platform)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(RepoDir);$(RepoDir)\src\cpp\leveldb;$(RepoDir)\src\cpp\leveldb\include;$(RepoDir)\src\cpp\protobuf\src;$(RepoDir)\src\cpp\protobuf\vsprojects;$(RepoDir)\build\proto;$(RepoDir)\Subtrees\beast;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>USE_LEVELDB;BOOST_TEST_ALTERNATIVE_INIT_API;BOOST_TEST_NO_MAIN;_WIN32_WINNT=0x0600;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level3</WarningLevel>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<BuildMacro Include="RepoDir">
<Value>$(RepoDir)</Value>
</BuildMacro>
<BuildMacro Include="SrcDir">
<Value>$(SrcDir)</Value>
</BuildMacro>
</ItemGroup>
</Project>

View File

@@ -1,20 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RippleD", "RippleD.vcxproj", "{EE95954F-3D34-4FB1-ADBD-FE8395233026}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EE95954F-3D34-4FB1-ADBD-FE8395233026}.Debug|Win32.ActiveCfg = Debug|Win32
{EE95954F-3D34-4FB1-ADBD-FE8395233026}.Debug|Win32.Build.0 = Debug|Win32
{EE95954F-3D34-4FB1-ADBD-FE8395233026}.Release|Win32.ActiveCfg = Release|Win32
{EE95954F-3D34-4FB1-ADBD-FE8395233026}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="..\..\modules\ripple_app\ripple_app_pt1.cpp" />
<ClCompile Include="..\..\modules\ripple_app\ripple_app_pt2.cpp" />
<ClCompile Include="..\..\modules\ripple_app\ripple_app_pt3.cpp" />
<ClCompile Include="..\..\modules\ripple_app\ripple_app_pt4.cpp" />
<ClCompile Include="..\..\modules\ripple_basics\ripple_basics.cpp" />
<ClCompile Include="..\..\modules\ripple_data\ripple_data.cpp" />
<ClCompile Include="..\..\Subtrees\beast\modules\beast_basics\beast_basics.cpp">
<Filter>Subtrees</Filter>
</ClCompile>
<ClCompile Include="..\..\Subtrees\beast\modules\beast_core\beast_core.cpp">
<Filter>Subtrees</Filter>
</ClCompile>
<ClCompile Include="..\..\src\cpp\leveldb_core.cpp">
<Filter>Subtrees</Filter>
</ClCompile>
<ClCompile Include="..\..\src\cpp\protobuf_core.cpp">
<Filter>Subtrees</Filter>
</ClCompile>
<ClCompile Include="..\..\src\cpp\websocket_core.cpp">
<Filter>Subtrees</Filter>
</ClCompile>
<ClCompile Include="..\..\src\cpp\database\sqlite3.c">
<Filter>Subtrees</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="Ripple">
<UniqueIdentifier>{63db902e-0e7a-42d1-b5f5-663e4b48786c}</UniqueIdentifier>
</Filter>
<Filter Include="Subtrees">
<UniqueIdentifier>{469e8a0a-64bf-4fa1-8b6f-81207db68577}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

View File

@@ -5,8 +5,8 @@
<RepoDir>..\..</RepoDir>
</PropertyGroup>
<PropertyGroup>
<OutDir>$(RepoDir)\build\VisualStudio2012\$(Configuration).$(Platform)\</OutDir>
<IntDir>$(RepoDir)\build\obj\VisualStudio2012\$(Configuration).$(Platform)\</IntDir>
<OutDir>$(RepoDir)\build\VisualStudio2013\$(Configuration).$(Platform)\</OutDir>
<IntDir>$(RepoDir)\build\obj\VisualStudio2013\$(Configuration).$(Platform)\</IntDir>
<TargetName>rippled</TargetName>
</PropertyGroup>
<ItemDefinitionGroup>
@@ -14,7 +14,7 @@
<PreprocessorDefinitions>_VARIADIC_MAX=10;_WIN32_WINNT=0x0600;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>$(RepoDir)\src\protobuf\src;$(RepoDir)\src\protobuf\vsprojects;$(RepoDir)\src;$(RepoDir)\src\leveldb;$(RepoDir)\src\leveldb\include;$(RepoDir)\build\proto;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(RepoDir)\src\BeastConfig;$(RepoDir)\src\protobuf\src;$(RepoDir)\src\protobuf\vsprojects;$(RepoDir)\src\leveldb;$(RepoDir)\src\leveldb\include;$(RepoDir)\build\proto;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<ExceptionHandling>Async</ExceptionHandling>
<DisableSpecificWarnings>4018;4244</DisableSpecificWarnings>

View File

@@ -1,9 +1,11 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RippleD", "RippleD.vcxproj", "{B7F39ECD-473C-484D-BC34-31F8362506A5}"
# Visual Studio 2013
VisualStudioVersion = 12.0.30110.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "beast", "..\..\src\beast\Builds\VisualStudio2013\beast.vcxproj", "{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "beast", "..\..\src\beast\Builds\VisualStudio2012\beast.vcxproj", "{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RippleD", "RippleD.vcxproj", "{B7F39ECD-473C-484D-BC34-31F8362506A5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -13,14 +15,6 @@ Global
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|Win32.ActiveCfg = Debug|Win32
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|Win32.Build.0 = Debug|Win32
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|x64.ActiveCfg = Debug|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|x64.Build.0 = Debug|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|Win32.ActiveCfg = Release|Win32
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|Win32.Build.0 = Release|Win32
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|x64.ActiveCfg = Release|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|x64.Build.0 = Release|x64
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|Win32.ActiveCfg = Debug|Win32
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|Win32.Build.0 = Debug|Win32
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|x64.ActiveCfg = Debug|x64
@@ -29,6 +23,14 @@ Global
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Release|Win32.Build.0 = Release|Win32
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Release|x64.ActiveCfg = Release|x64
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Release|x64.Build.0 = Release|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|Win32.ActiveCfg = Debug|Win32
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|Win32.Build.0 = Debug|Win32
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|x64.ActiveCfg = Debug|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Debug|x64.Build.0 = Debug|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|Win32.ActiveCfg = Release|Win32
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|Win32.Build.0 = Release|Win32
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|x64.ActiveCfg = Release|x64
{B7F39ECD-473C-484D-BC34-31F8362506A5}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

BIN
LICENSE

Binary file not shown.

View File

@@ -1,6 +1,6 @@
#Ripple - P2P Payment Network
##[![Build Status](https://ci.ripple.com/jenkins/buildStatus/icon?job=rippled)](https://ci.ripple.com/jenkins/job/rippled/)
##[![Build Status](https://travis-ci.org/ripple/rippled.png?branch=develop)](https://travis-ci.org/ripple/rippled)
This is the repository for Ripple's `rippled`, reference P2P network server.

View File

@@ -8,6 +8,7 @@ import glob
import os
import platform
import re
import sys
OSX = bool(platform.mac_ver()[0])
FreeBSD = bool('FreeBSD' == platform.system())
@@ -16,10 +17,12 @@ Ubuntu = bool(Linux and 'Ubuntu' == platform.linux_distribution()[0])
Debian = bool(Linux and 'debian' == platform.linux_distribution()[0])
Archlinux = bool(Linux and ('','','') == platform.linux_distribution()) #Arch still has issues with the platform module
USING_CLANG = OSX or os.environ.get('CC', None) == 'clang'
#
# We expect this to be set
#
BOOST_HOME = os.environ.get("RIPPLED_BOOST_HOME", None)
#
BOOST_HOME = os.environ.get("RIPPLED_BOOST_HOME", None)
if OSX or Ubuntu or Debian or Archlinux:
@@ -33,8 +36,12 @@ else:
# scons tools
#
HONOR_ENVS = ['CC', 'CXX', 'PATH']
env = Environment(
tools = ['default', 'protoc']
tools = ['default', 'protoc'],
#ENV = dict((k, os.environ[k]) for k in HONOR_ENVS)
ENV = dict((k, os.environ[k]) for k in HONOR_ENVS if k in os.environ)
)
# Use a newer gcc on FreeBSD
@@ -44,12 +51,19 @@ if FreeBSD:
env.Append(CCFLAGS = ['-Wl,-rpath=/usr/local/lib/gcc46'])
env.Append(LINKFLAGS = ['-Wl,-rpath=/usr/local/lib/gcc46'])
if OSX:
if USING_CLANG:
env.Replace(CC= 'clang')
env.Replace(CXX= 'clang++')
env.Append(CXXFLAGS = ['-std=c++11', '-stdlib=libc++'])
env.Append(LINKFLAGS='-stdlib=libc++')
env['FRAMEWORKS'] = ['AppKit']
if Linux:
env.Append(CXXFLAGS = ['-std=c++11', '-stdlib=libstdc++'])
env.Append(LINKFLAGS='-stdlib=libstdc++')
if OSX:
env.Append(CXXFLAGS = ['-std=c++11', '-stdlib=libc++',
'-Wno-deprecated-register'])
env.Append(LINKFLAGS='-stdlib=libc++')
env['FRAMEWORKS'] = ['AppKit','Foundation']
GCC_VERSION = re.split('\.', commands.getoutput(env['CXX'] + ' -dumpversion'))
@@ -93,17 +107,28 @@ BOOST_LIBS = [
'boost_regex',
'boost_system',
'boost_thread',
'boost_random',
]
# We whitelist platforms where the non -mt version is linked with pthreads. This
# can be verified with: ldd libboost_filesystem.* If a threading library is
# included the platform can be whitelisted.
if FreeBSD or Ubuntu or Archlinux or OSX:
# if FreeBSD or Ubuntu or Archlinux:
if not (USING_CLANG and Linux) and (FreeBSD or Ubuntu or Archlinux or Debian or OSX):
# non-mt libs do link with pthreads.
env.Append(
LIBS = BOOST_LIBS
)
elif Linux and USING_CLANG and Ubuntu:
# It's likely going to be here if using boost 1.55
boost_statics = [ ("/usr/lib/x86_64-linux-gnu/lib%s.a" % a) for a in
BOOST_LIBS ]
if not all(os.path.exists(f) for f in boost_statics):
# Else here
boost_statics = [("/usr/lib/lib%s.a" % a) for a in BOOST_LIBS]
env.Append(LIBS = [File(f) for f in boost_statics])
else:
env.Append(
LIBS = [l + '-mt' for l in BOOST_LIBS]
@@ -124,11 +149,10 @@ else:
#
INCLUDE_PATHS = [
'.',
'src',
'src/BeastConfig',
'src/leveldb',
'src/leveldb/port',
'src/leveldb/include',
'src/beast',
'build/proto'
]
@@ -159,12 +183,15 @@ COMPILED_FILES.extend([
'src/ripple/http/ripple_http.cpp',
'src/ripple/json/ripple_json.cpp',
'src/ripple/peerfinder/ripple_peerfinder.cpp',
'src/ripple/rpc/ripple_rpc.cpp',
'src/ripple/sophia/ripple_sophia.c',
'src/ripple/radmap/ripple_radmap.cpp',
'src/ripple/resource/ripple_resource.cpp',
'src/ripple/rocksdb/ripple_rocksdb.cpp',
'src/ripple/sitefiles/ripple_sitefiles.cpp',
'src/ripple/sslutil/ripple_sslutil.cpp',
'src/ripple/testoverlay/ripple_testoverlay.cpp',
'src/ripple/types/ripple_types.cpp',
'src/ripple/validators/ripple_validators.cpp'
'src/ripple/validators/ripple_validators.cpp',
'src/ripple/common/ripple_common.cpp',
])
# ------------------------------
@@ -180,13 +207,15 @@ COMPILED_FILES.extend([
'src/ripple_app/ripple_app_pt6.cpp',
'src/ripple_app/ripple_app_pt7.cpp',
'src/ripple_app/ripple_app_pt8.cpp',
'src/ripple_app/ripple_app_pt9.cpp',
'src/ripple_basics/ripple_basics.cpp',
'src/ripple_core/ripple_core.cpp',
'src/ripple_data/ripple_data.cpp',
'src/ripple_hyperleveldb/ripple_hyperleveldb.cpp',
'src/ripple_leveldb/ripple_leveldb.cpp',
'src/ripple_mdb/ripple_mdb.c',
'src/ripple_net/ripple_net.cpp',
'src/ripple_overlay/ripple_overlay.cpp',
'src/ripple_rpc/ripple_rpc.cpp',
'src/ripple_websocket/ripple_websocket.cpp'
])
@@ -225,7 +254,7 @@ env.Append(
['rt'] if not OSX else [] +\
[
'z'
]
]
)
# We prepend, in case there's another BOOST somewhere on the path
@@ -236,23 +265,41 @@ if BOOST_HOME is not None:
if not OSX:
env.Append(LINKFLAGS = [
'-rdynamic', '-pthread',
'-rdynamic',
'-pthread',
])
DEBUGFLAGS = ['-g', '-DDEBUG', '-D_DEBUG']
env.Append(CCFLAGS = ['-pthread', '-Wall', '-Wno-sign-compare', '-Wno-char-subscripts']+DEBUGFLAGS)
env.Append(CXXFLAGS = ['-O1', '-pthread', '-Wno-invalid-offsetof', '-Wformat']+DEBUGFLAGS)
if not USING_CLANG:
more_warnings = ['-Wno-unused-local-typedefs']
else:
# This disables the "You said it was a struct AND a class, wth is going on
# warnings"
more_warnings = ['-Wno-mismatched-tags']
# This needs to be a CCFLAGS not a CXXFLAGS
env.Append(CCFLAGS = more_warnings)
env.Append(CXXFLAGS = ['-O1','-pthread', '-Wno-invalid-offsetof', '-Wformat']+more_warnings+DEBUGFLAGS)
# RTTI is required for Beast and CountedObject.
#
env.Append(CXXFLAGS = ['-frtti'])
if (int(GCC_VERSION[0]) == 4 and int(GCC_VERSION[1]) == 6):
env.Append(CXXFLAGS = ['-std=c++0x'])
elif (int(GCC_VERSION[0]) > 4 or (int(GCC_VERSION[0]) == 4 and int(GCC_VERSION[1]) >= 7)):
env.Append(CXXFLAGS = ['-std=c++11'])
UBUNTU_GCC_48_INSTALL_STEPS = '''
https://ripple.com/wiki/Ubuntu_build_instructions#Ubuntu_versions_older_than_13.10_:_Install_gcc_4.8'''
if not USING_CLANG:
if (int(GCC_VERSION[0]) == 4 and int(GCC_VERSION[1]) < 8):
print "\nrippled, using c++11, requires g++ version >= 4.8 to compile"
if Ubuntu:
print UBUNTU_GCC_48_INSTALL_STEPS
sys.exit(1)
else:
env.Append(CXXFLAGS = ['-std=c++11'])
# FreeBSD doesn't support O_DSYNC
if FreeBSD:

View File

@@ -60,30 +60,37 @@
#
# [ips]
#
# List of ips where the Ripple protocol is served. For a starter list,
# you can copy entries from: https://ripple.com/ripple.txt
# List of hostnames or ips where the Ripple protocol is served. For a starter
# list, you can either copy entries from: https://ripple.com/ripple.txt or if
# you prefer you can specify r.ripple.com 51235
#
# Domain names are not allowed. One ipv4 or ipv6 address per line. A port
# may optionally be specified after adding a space to the address. By
# convention, if known, IPs are listed in from most to least trusted.
# One IPv4 address or domain names per line is allowed. A port may optionally
# be specified after adding a space to the address. By convention, if known,
# IPs are listed in from most to least trusted.
#
# Examples:
# 192.168.0.1
# 192.168.0.1 3939
# 2001:0db8:0100:f101:0210:a4ff:fee3:9566
# r.ripple.com 51235
#
# Here's the recent set of good, well known addresses:
# This will give you a good, up-to-date list of addresses:
#
# [ips]
# 54.225.112.220 51235
# 54.225.123.13 51235
# 54.227.239.106 51235
# 107.21.251.218 51235
# 184.73.226.101 51235
# 23.23.201.55 51235
# r.ripple.com 51235
#
#
#
# [ips_fixed]
#
# List of IP addresses or hostnames to which rippled should always attempt to
# maintain peer connections with. This is useful for manually forming private
# networks, for example to configure a validation server that connects to the
# Ripple network through a public-facing server, or for building a set
# of cluster peers.
#
# One IPv4 address or domain names per line is allowed. A port may optionally
# be specified after adding a space to the address.
#
# [peer_ip]
#
# IP address or domain to bind to allow external connections from peers.
@@ -484,6 +491,20 @@
#
#
#
# [fetch_depth]
#
# The number of past ledgers to serve to other peers that request historical
# ledger data (or "full" for no limit).
#
# Servers that require low latency and high local performance may wish to
# restrict the historical ledgers they are willing to serve. Setting this
# below 32 can harm network stability as servers require easy access to
# recent history to stay in sync. Values below 128 are not recommended.
#
# The default is: full
#
#
#
# [validation_seed]
#
# To perform validation, this section should contain either a validation seed
@@ -645,8 +666,8 @@
# Choices for 'type' (not case-sensitive)
# HyperLevelDB Use an improved version of LevelDB (preferred)
# LevelDB Use Google's LevelDB database (deprecated)
# MDB Use MDB
# none Use no backend
# RocksDB Use Facebook's RocksDB database
# SQLite Use SQLite
#
# Required keys:
@@ -697,6 +718,41 @@
#
#
#
# [insight]
#
# 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
# collection metrics are sent. The parameters are expressed as key = value
# pairs with no white space. The main parameter is the choice of server:
#
# "server"
#
# Choice of server to send metrics to. Currently the only choice is
# "statsd" which sends UDP packets to a StatsD daemon, which must be
# running while rippled is running. More information on StatsD is
# available here:
# https://github.com/b/statsd_spec
#
# When server=statsd, these additional keys are used:
#
# "address" The UDP address and port of the listening StatsD server,
# in the format, n.n.n.n:port.
#
# "prefix" A string prepended to each collected metric. This is used
# to distinguish between different running instances of rippled.
#
# If this section is missing, or the server type is unspecified or unknown,
# statistics are not collected or reported.
#
# Example:
#
# [insight]
# server=statsd
# address=192.168.0.95:4201
# prefix=my_validator
#
#-------------------------------------------------------------------------------
# Allow other peers to connect to this server.
@@ -738,13 +794,14 @@
medium
# Note that HyperLevelDB is unavailable on Windows platforms
#
[node_db]
type=HyperLevelDB
path=db/hyperldb
path=/etc/ripple/db/hyperldb
# This needs to be an absolute directory reference, not a relative one.
# Modify this value as required.
[debug_logfile]
log/debug.log
/var/log/rippled/debug.log
[sntp_servers]
time.windows.com
@@ -753,12 +810,20 @@ time.nist.gov
pool.ntp.org
# Where to find some other servers speaking the Ripple protocol.
# This set of addresses is recent as of September 5, 2013
#
[ips]
54.225.112.220 51235
54.225.123.13 51235
54.227.239.106 51235
107.21.251.218 51235
184.73.226.101 51235
23.23.201.55 51235
r.ripple.com 51235
# These validators are taken from the v0.16 release notes on the wiki:
# https://ripple.com/wiki/Latest_rippled_release_notes
[validators]
n9KPnVLn7ewVzHvn218DcEYsnWLzKerTDwhpofhk4Ym1RUq4TeGw RIP1
n9LFzWuhKNvXStHAuemfRKFVECLApowncMAM5chSCL9R5ECHGN4V RIP2
n94rSdgTyBNGvYg8pZXGuNt59Y5bGAZGxbxyvjDaqD9ceRAgD85P RIP3
n9LeQeDcLDMZKjx1TZtrXoLBLo5q1bR1sUQrWG7tEADFU6R27UBp RIP4
n9KF6RpvktjNs2MDBkmxpJbup4BKrKeMKDXPhaXkq7cKTwLmWkFr RIP5
# Ditto.
[validation_quorum]
3

114
doc/rippled.init Normal file
View File

@@ -0,0 +1,114 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: ripple
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the ripple network node
# Description: starts rippled using start-stop-daemon
### END INIT INFO
set -e
NAME=rippled
USER="rippled"
GROUP="rippled"
PIDFILE=/var/run/$NAME.pid
DAEMON=/usr/local/sbin/rippled
DAEMON_OPTS="--conf /etc/ripple/rippled.cfg"
NET_OPTS="--net $DAEMON_OPTS"
LOGDIR="/var/log/rippled"
DBDIR="/var/db/rippled/db/hyperldb"
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
# I wish it didn't come down to this, but this is the easiest way to ensure
# sanity of an install.
if [ ! -d $LOGDIR ]; then
mkdir -p $LOGDIR
chown $USER:$GROUP $LOGDIR
fi
if [ ! -d $DBDIR ]; then
mkdir -p $DBDIR
chown -R $USER:$GROUP $DBDIR
fi
case "$1" in
start)
echo -n "Starting daemon: "$NAME
start-stop-daemon --start --quiet --background -m --pidfile $PIDFILE \
--exec $DAEMON --chuid $USER --group $GROUP --verbose -- $NET_OPTS
echo "."
;;
stop)
echo -n "Stopping daemon: "$NAME
$DAEMON $DAEMON_OPTS stop
rm -f $PIDFILE
echo "."
;;
restart)
echo -n "Restarting daemon: "$NAME
$DAEMON $DAEMON_OPTS stop
rm -f $PIDFILE
start-stop-daemon --start --quiet --background -m --pidfile $PIDFILE \
--exec $DAEMON --chuid $USER --group $GROUP -- $NET_OPTS
echo "."
;;
status)
echo "Status of $NAME:"
echo -n "PID of $NAME: "
if [ -f "$PIDFILE" ]; then
cat $PIDFILE
$DAEMON $DAEMON_OPTS server_info
else
echo "$NAME not running."
fi
echo "."
;;
fetch)
echo "$NAME ledger fetching info:"
$DAEMON $DAEMON_OPTS fetch_info
echo "."
;;
uptime)
echo "$NAME uptime:"
$DAEMON $DAEMON_OPTS get_counts
echo "."
;;
startconfig)
echo "$NAME is being started with the following command line:"
echo "$DAEMON $NET_OPTS"
echo "."
;;
command)
# Truncate the script's argument vector by one position to get rid of
# this entry.
shift
# Pass the remainder of the argument vector to rippled.
$DAEMON $DAEMON_OPTS "$@"
echo "."
;;
test)
$DAEMON $DAEMON_OPTS ping
echo "."
;;
*)
echo "Usage: $0 {start|stop|restart|status|fetch|uptime|startconfig|"
echo " command|test}"
exit 1
esac
exit 0

View File

@@ -4,20 +4,12 @@ RIPPLE TODO
Vinnie's List: Changes day to day, descending priority
- PeerFinder work
- Fix and tidy up broken beast classes
- Validators work
* Parse Validator line using cribbed code
- Parse ContentBodyBuffer from HTTPResponse
- HTTPMessage improvements
- HTTPClient improvements based on HTTPServer
- HTTPMessage improvements
- Ditch old HTTPClient so I can take the name
- Finish RPCAsyncServer, RPCService and RPCService::Manager
- Fix RPCDoor to respect config setting for [rpc_secure]
- Validators should delay the application of newly downloaded lists from
sources, to mitigate the effects of attacks. Unless there's no validators
in the list.
- Validators RPC options to immediately apply UNL,
manually revisit sources, etc...
- Clean up calculation of COnfig file location.
- Remove TESTNET and all related code and settings.
- Remove addRpcSub, findRpcSub, and notify the appropriate partner(s)
@@ -28,9 +20,18 @@ David Features:
--------------------------------------------------------------------------------
- std::priority_queue for DeadlineTimer
- Validators should delay the application of newly downloaded lists from
sources, to mitigate the effects of attacks. Unless there's no validators
in the list.
- Validators RPC options to immediately apply UNL,
manually revisit sources, etc...
- Look into using CMake
- IPv6 support in IPEndpoint
- IPv6 support in IP::Endpoint
- Configuration list for Jenkins
@@ -87,8 +88,6 @@ David Features:
- Add "skipped" field to beginTestCase() to disable a test but still record
that it was skipped in the output. Like for mdb import.
- use beast DeadlineTimer for sweep in Application
- Get rid of 'ref' typedefs that really mean const&
- Use secp256k1 from beast
@@ -122,10 +121,6 @@ David Features:
- Rename RPCHandler to CallHandler
- Profile/VTune the application to identify hot spots
* Determine why rippled has a slow startup on Windows
* Improve the performance when running all unit tests on Windows
- Rename "fullBelow" to something like haveAllDescendants or haveAllChildren.
- Rewrite Sustain to use Beast and work on Windows as well
@@ -133,18 +128,10 @@ David Features:
- Make sure the leak detector output appears on Linux and FreeBSD debug builds.
- Create SharedData <LoadState>, move all load related state variables currently
protected by separated mutexes in different classes into the LoadState, and
use read/write locking semantics to update the values. Later, use Listeners
to notify dependent code to resolve the dependency inversion.
- Rename LoadMonitor to LoadMeter, change LoadEvent to LoadMeter::ScopedSample
- Rename LedgerMaster to Ledgers, create ILedgers interface.
- Figure out where previous ledgers go after a call to LedgerMaster::pushLedger()
and see if it is possible to clean up the leaks on exit.
- Replace all NULL with nullptr
- Make TxFormats a member of ICore instead of a singleton.
@@ -152,8 +139,6 @@ David Features:
singleton. It might have to remain a singleton. At the very least,
it should be a SharedSingleton to resolve ordering issues.
- Rename include guards to boost style, e.g. RIPPLE_LOG_H_INCLUDED
- Replace C11X with BEAST_COMPILER_SUPPORTS_MOVE_SEMANTICS
- Remove "ENABLE_INSECURE" when the time is right.
@@ -161,8 +146,6 @@ David Features:
- lift unique_ptr / auto_ptr into ripple namespace,
or replace with ScopedPointer (preferred)
- Make LevelDB and Ripple code work with both Unicode and non-Unicode Windows APIs
- Go searching through VFALCO notes and fix everything
- Deal with function-level statics used for SqliteDatabase (like in
@@ -173,30 +156,8 @@ David Features:
STObject
SerializedLedgerEntry
- Replace uint160, uint256 in argument lists, template parameter lists, and
data members with tyepdefs from ripple_ProtocolTypes.h
- Consolidate SQLite database classes: DatabaseCon, Database, SqliteDatabase.
--------------------------------------------------------------------------------
HYPERLEVELDB TODO
--------------------------------------------------------------------------------
- Port to Windows
--------------------------------------------------------------------------------
LEVELDB TODO
--------------------------------------------------------------------------------
- Add VisualStudio 2012 project file to our fork
- Add LevelDB unity .cpp and .h to our fork
- Replace Beast specific platform macros with universal macros so that the
unity doesn't require Beast
- Submit LevelDB fork changes to Bitcoin upstream
--------------------------------------------------------------------------------
WEBSOCKET TODO
--------------------------------------------------------------------------------
@@ -213,65 +174,6 @@ PROTOCOL BUFFERS TODO
- Make a Visual Studio 2012 Project for source browsing
--------------------------------------------------------------------------------
NOTES
--------------------------------------------------------------------------------
LoadEvent
Is referenced with both a shared pointer and an auto pointer.
Should be named LoadMeter::ScopedSample. Or possibly ScopedLoadSample
JobQueue
getLoadEvent and getLoadEventAP differ only in the style of pointer
container which is returned. Unnecessary complexity.
Naming: Some names don't make sense.
Index
Stop using Index to refer to keys in tables. Replace with "Key" ?
Index implies a small integer, or a data structure.
This is all over the place in the Ledger API, "Index" of this and
"Index" of that, the terminology is imprecise and helps neither
understanding nor recall.
Inconsistent names
We have full names like SerializedType and then acronyms like STObject
Two names for some things, e.g. SerializedLedgerEntry and SLE
Shared/Smart pointer typedefs in classes have a variety of different names
for the same thing. e.g. "pointer", "ptr", "ptr_t", "wptr"
Verbose names
The prefix "Flat" is more appealing than "Serialized" because its shorter and
easier to pronounce.
Ledger "Skip List"
Is not really a skip list data structure. This is more appropriately
called an "index" although that name is currently used to identify hashes
used as keys.
Interfaces
Serializer
Upon analysis this class does two incompatible things. Flattening, and
unflattening. The interface should be reimplemented as two distinct
abstract classes, InputStream and OutputStream with suitable implementations
such as to and from a block of memory or dynamically allocated buffer.
The name and conflation of dual roles serves to confuse code at the point
of call. Does set(Serializer& s) flatten or unflatten the data? This
would be more clear:
bool write (OutputStream& stream);
We have beast for InputStream and OutputStream, we can use those now.
--------------------------------------------------------------------------------
Davidisms
--------------------------------------------------------------------------------
@@ -300,31 +202,3 @@ A node is "full below" if we believe we have (either in the database or
The fullBelowCache is a cache of hashes of nodes that are full below. Which means
there are no missing children
What we want from the unique node list:
- Some number of trusted roots (known by domain)
probably organizations whose job is to provide a list of validators
- We imagine the IRGA for example would establish some group whose job is to
maintain a list of validators. There would be a public list of criteria
that they would use to vet the validator. Things like:
* Not anonymous
* registered business
* Physical location
* Agree not to cease operations without notice / arbitrarily
* Responsive to complaints
- Identifiable jurisdiction
* Homogeneity in the jurisdiction is a business risk
* If all validators are in the same jurisdiction this is a business risk
- OpenCoin sets criteria for the organizations
- Rippled will ship with a list of trusted root "certificates"
In other words this is a list of trusted domains from which the software
can contact each trusted root and retrieve a list of "good" validators
and then do something with that information
- All the validation information would be public, including the broadcast
messages.
- The goal is to easily identify bad actors and assess network health
* Malicious intent
* Or, just hardware problems (faulty drive or memory)

View File

@@ -13,14 +13,16 @@
"ripple-lib": "0.7.25",
"async": "~0.2.9",
"extend": "~1.2.0",
"simple-jsonrpc": "~0.0.2"
"simple-jsonrpc": "~0.0.2",
"deep-equal": "0.0.0"
},
"devDependencies": {
"coffee-script": "~1.6.3",
"mocha": "~1.13.0"
},
"scripts": {
"test": "mocha --reporter spec --ui tdd --timeout 10000 --slow 600 test/*-test.js"
"test": "mocha test/websocket-test.js test/server-test.js test/*-test.{js,coffee}"
},
"repository": {
@@ -29,4 +31,4 @@
},
"readmeFilename": "README.md"
}
}

View File

@@ -107,6 +107,13 @@
#define BEAST_ZLIB_INCLUDE_PATH <zlib.h>
#endif
/** Config: BEAST_SQLITE_FORCE_NDEBUG
Setting this option forces sqlite into release mode even if NDEBUG is not set
*/
#ifndef BEAST_SQLITE_FORCE_NDEBUG
#define BEAST_SQLITE_FORCE_NDEBUG 1
#endif
//------------------------------------------------------------------------------
//
// Boost
@@ -156,26 +163,25 @@
//------------------------------------------------------------------------------
// These control whether or not certain functionality gets
// compiled into the resulting rippled executable
/** Config: RIPPLE_ROCKSDB_AVAILABLE
Controls whether or not the RocksDB database back-end is compiled into
rippled. RocksDB requires a relatively modern C++ compiler (tested with
gcc versions 4.8.1 and later) that supports some C++11 features.
*/
#ifndef RIPPLE_ROCKSDB_AVAILABLE
//#define RIPPLE_ROCKSDB_AVAILABLE 0
#endif
//------------------------------------------------------------------------------
// Here temporarily to turn off new Validations code while it
// is being written.
//
#ifndef RIPPLE_USE_NEW_VALIDATORS
#define RIPPLE_USE_NEW_VALIDATORS 0
#endif
// Turning this on will use the new PeerFinder logic to establish connections
// to other peers. Even with this off, PeerFinder will still send mtENDPOINTS
// messages as needed, and collect legacy IP endpoint information.
//
#ifndef RIPPLE_USE_PEERFINDER
#define RIPPLE_USE_PEERFINDER 0
#endif
// Here temporarily
// Controls whether or not the new RPC::Manager logic will be
// used to invoke RPC commands before they pass to the original code.
#ifndef RIPPLE_USE_RPC_SERVICE_MANAGER
#define RIPPLE_USE_RPC_SERVICE_MANAGER 0
#ifndef RIPPLE_USE_VALIDATORS
#define RIPPLE_USE_VALIDATORS 0
#endif
#endif

View File

@@ -21,6 +21,16 @@ About git-subtree:
https://github.com/apenwarr/git-subtree <br>
http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/ <br>
<table align=left><tr>
<th>dir</th>
<th>What</th>
</tr><tr>
<td>beast</td>
<td>Beast, the amazing cross-platform library.<br>
git@github.com:vinniefalco/Beast.git
</td>
</tr></table>
## ./beast
Beast, the amazing cross-platform library.

View File

@@ -15,6 +15,7 @@ Docs
*.manifest
*.manifest.res
*.o
*.opensdf
*.d
*.sdf
xcuserdata
@@ -24,5 +25,5 @@ contents.xcworkspacedata
profile
Builds/VisualStudio2012/Debug
Builds/VisualStudio2012/Release
project.xcworkspace
modules/beast_cryptopp

View File

@@ -8,7 +8,7 @@
<ItemDefinitionGroup>
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>BEAST_COMPILING_STATIC_LIBARARY=1;_CRTDBG_MAP_ALLOC;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>BEAST_COMPILING_STATIC_LIBARARY=1;_CRTDBG_MAP_ALLOC;_WIN32_WINNT=0x0600;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
<AdditionalIncludeDirectories>$(RepoDir)\config;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
@@ -82,9 +82,29 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\beast\Arithmetic.h" />
<ClInclude Include="..\..\beast\Asio.h" />
<ClInclude Include="..\..\beast\asio\abstract_socket.h" />
<ClInclude Include="..\..\beast\asio\bind_handler.h" />
<ClInclude Include="..\..\beast\asio\buffer_sequence.h" />
<ClInclude Include="..\..\beast\asio\io_latency_probe.h" />
<ClInclude Include="..\..\beast\asio\IPAddressConversion.h" />
<ClInclude Include="..\..\beast\asio\placeholders.h" />
<ClInclude Include="..\..\beast\asio\shared_handler.h" />
<ClInclude Include="..\..\beast\asio\socket_wrapper.h" />
<ClInclude Include="..\..\beast\asio\wrap_handler.h" />
<ClInclude Include="..\..\beast\Atomic.h" />
<ClInclude Include="..\..\beast\Boost.h" />
<ClInclude Include="..\..\beast\boost\ErrorCode.h" />
<ClInclude Include="..\..\beast\ByteOrder.h" />
<ClInclude Include="..\..\beast\chrono\abstract_clock.h" />
<ClInclude Include="..\..\beast\chrono\basic_seconds_clock.h" />
<ClInclude Include="..\..\beast\chrono\chrono_io.h" />
<ClInclude Include="..\..\beast\chrono\chrono_util.h" />
<ClInclude Include="..\..\beast\chrono\CPUMeter.h" />
<ClInclude Include="..\..\beast\chrono\manual_clock.h" />
<ClInclude Include="..\..\beast\chrono\ratio_io.h" />
<ClInclude Include="..\..\beast\chrono\RelativeTime.h" />
<ClInclude Include="..\..\beast\chrono\ScopedTimeInterval.h" />
<ClInclude Include="..\..\beast\Config.h" />
<ClInclude Include="..\..\beast\config\CompilerConfig.h" />
<ClInclude Include="..\..\beast\config\compiler\Clang.h" />
@@ -103,36 +123,82 @@
<ClInclude Include="..\..\beast\config\SelectPlatformConfig.h" />
<ClInclude Include="..\..\beast\config\SelectStdlibConfig.h" />
<ClInclude Include="..\..\beast\config\StandardConfig.h" />
<ClInclude Include="..\..\beast\container\aged_container_utility.h" />
<ClInclude Include="..\..\beast\container\aged_container.h" />
<ClInclude Include="..\..\beast\container\aged_map.h" />
<ClInclude Include="..\..\beast\container\aged_multimap.h" />
<ClInclude Include="..\..\beast\container\aged_multiset.h" />
<ClInclude Include="..\..\beast\container\aged_set.h" />
<ClInclude Include="..\..\beast\container\aged_unordered_map.h" />
<ClInclude Include="..\..\beast\container\aged_unordered_multimap.h" />
<ClInclude Include="..\..\beast\container\aged_unordered_multiset.h" />
<ClInclude Include="..\..\beast\container\aged_unordered_set.h" />
<ClInclude Include="..\..\beast\container\detail\aged_associative_container.h" />
<ClInclude Include="..\..\beast\container\detail\aged_ordered_container.h" />
<ClInclude Include="..\..\beast\container\detail\aged_container_iterator.h" />
<ClInclude Include="..\..\beast\container\detail\aged_unordered_container.h" />
<ClInclude Include="..\..\beast\container\buffer_view.h" />
<ClInclude Include="..\..\beast\Crypto.h" />
<ClInclude Include="..\..\beast\crypto\BinaryEncoding.h" />
<ClInclude Include="..\..\beast\crypto\impl\sha2\sha2.h" />
<ClInclude Include="..\..\beast\crypto\MurmurHash.h" />
<ClInclude Include="..\..\beast\crypto\Sha256.h" />
<ClInclude Include="..\..\beast\crypto\UnsignedInteger.h" />
<ClInclude Include="..\..\beast\crypto\UnsignedIntegerCalc.h" />
<ClInclude Include="..\..\beast\CStdInt.h" />
<ClInclude Include="..\..\beast\cxx14\algorithm.h" />
<ClInclude Include="..\..\beast\cxx14\config.h" />
<ClInclude Include="..\..\beast\cxx14\functional.h" />
<ClInclude Include="..\..\beast\cxx14\memory.h" />
<ClInclude Include="..\..\beast\cxx14\type_traits.h" />
<ClInclude Include="..\..\beast\cxx14\utility.h" />
<ClInclude Include="..\..\beast\cyclic_iterator.h" />
<ClInclude Include="..\..\beast\FixedArray.h" />
<ClInclude Include="..\..\beast\HeapBlock.h" />
<ClInclude Include="..\..\beast\HTTP.h" />
<ClInclude Include="..\..\beast\http\impl\http-parser\http_parser.h" />
<ClInclude Include="..\..\beast\http\impl\http_parser.h" />
<ClInclude Include="..\..\beast\http\ParsedURL.h" />
<ClInclude Include="..\..\beast\http\URL.h" />
<ClInclude Include="..\..\beast\Insight.h" />
<ClInclude Include="..\..\beast\insight\Base.h" />
<ClInclude Include="..\..\beast\insight\BaseImpl.h" />
<ClInclude Include="..\..\beast\insight\Collector.h" />
<ClInclude Include="..\..\beast\insight\Counter.h" />
<ClInclude Include="..\..\beast\insight\CounterImpl.h" />
<ClInclude Include="..\..\beast\insight\Event.h" />
<ClInclude Include="..\..\beast\insight\EventImpl.h" />
<ClInclude Include="..\..\beast\insight\Gauge.h" />
<ClInclude Include="..\..\beast\insight\GaugeImpl.h" />
<ClInclude Include="..\..\beast\insight\Group.h" />
<ClInclude Include="..\..\beast\insight\Groups.h" />
<ClInclude Include="..\..\beast\insight\Hook.h" />
<ClInclude Include="..\..\beast\insight\HookImpl.h" />
<ClInclude Include="..\..\beast\insight\Meter.h" />
<ClInclude Include="..\..\beast\insight\MeterImpl.h" />
<ClInclude Include="..\..\beast\insight\NullCollector.h" />
<ClInclude Include="..\..\beast\insight\StatsDCollector.h" />
<ClInclude Include="..\..\beast\Intrusive.h" />
<ClInclude Include="..\..\beast\intrusive\ForwardList.h" />
<ClInclude Include="..\..\beast\intrusive\IntrusiveArray.h" />
<ClInclude Include="..\..\beast\intrusive\List.h" />
<ClInclude Include="..\..\beast\intrusive\LockFreeStack.h" />
<ClInclude Include="..\..\beast\intrusive\PointerTraits.h" />
<ClInclude Include="..\..\beast\Memory.h" />
<ClInclude Include="..\..\beast\MPL.h" />
<ClInclude Include="..\..\beast\mpl\AddConst.h" />
<ClInclude Include="..\..\beast\mpl\CopyConst.h" />
<ClInclude Include="..\..\beast\mpl\IfCond.h" />
<ClInclude Include="..\..\beast\mpl\IsCallPossible.h" />
<ClInclude Include="..\..\beast\mpl\PointerToOther.h" />
<ClInclude Include="..\..\beast\mpl\RemoveConst.h" />
<ClInclude Include="..\..\beast\mpl\RemoveConstVolatile.h" />
<ClInclude Include="..\..\beast\mpl\RemoveReference.h" />
<ClInclude Include="..\..\beast\mpl\RemoveVolatile.h" />
<ClInclude Include="..\..\beast\Net.h" />
<ClInclude Include="..\..\beast\net\BufferType.h" />
<ClInclude Include="..\..\beast\net\detail\Parse.h" />
<ClInclude Include="..\..\beast\net\DynamicBuffer.h" />
<ClInclude Include="..\..\beast\net\IPAddress.h" />
<ClInclude Include="..\..\beast\net\IPAddressV4.h" />
<ClInclude Include="..\..\beast\net\IPAddressV6.h" />
<ClInclude Include="..\..\beast\net\IPEndpoint.h" />
<ClInclude Include="..\..\beast\SafeBool.h" />
<ClInclude Include="..\..\beast\SmartPtr.h" />
<ClInclude Include="..\..\beast\smart_ptr\AbstractObject.h" />
<ClInclude Include="..\..\beast\smart_ptr\ContainerDeletePolicy.h" />
<ClInclude Include="..\..\beast\smart_ptr\ScopedPointer.h" />
<ClInclude Include="..\..\beast\smart_ptr\SharedObject.h" />
<ClInclude Include="..\..\beast\smart_ptr\SharedPtr.h" />
<ClInclude Include="..\..\beast\StaticAssert.h" />
<ClInclude Include="..\..\beast\Strings.h" />
<ClInclude Include="..\..\beast\strings\CharacterFunctions.h" />
@@ -144,36 +210,43 @@
<ClInclude Include="..\..\beast\strings\String.h" />
<ClInclude Include="..\..\beast\strings\StringCharPointerType.h" />
<ClInclude Include="..\..\beast\strings\StringFromNumber.h" />
<ClInclude Include="..\..\beast\Thread.h" />
<ClInclude Include="..\..\beast\thread\LockGuard.h" />
<ClInclude Include="..\..\beast\thread\SharedData.h" />
<ClInclude Include="..\..\beast\thread\SharedLockGuard.h" />
<ClInclude Include="..\..\beast\thread\SharedMutexAdapter.h" />
<ClInclude Include="..\..\beast\Threads.h" />
<ClInclude Include="..\..\beast\Chrono.h" />
<ClInclude Include="..\..\beast\threads\detail\BindHandler.h" />
<ClInclude Include="..\..\beast\threads\detail\DispatchedHandler.h" />
<ClInclude Include="..\..\beast\threads\LockGuard.h" />
<ClInclude Include="..\..\beast\threads\RecursiveMutex.h" />
<ClInclude Include="..\..\beast\threads\semaphore.h" />
<ClInclude Include="..\..\beast\threads\ServiceQueue.h" />
<ClInclude Include="..\..\beast\threads\SharedData.h" />
<ClInclude Include="..\..\beast\threads\SharedLockGuard.h" />
<ClInclude Include="..\..\beast\threads\SharedMutexAdapter.h" />
<ClInclude Include="..\..\beast\threads\SpinLock.h" />
<ClInclude Include="..\..\beast\threads\Stoppable.h" />
<ClInclude Include="..\..\beast\threads\Thread.h" />
<ClInclude Include="..\..\beast\threads\ThreadLocalValue.h" />
<ClInclude Include="..\..\beast\threads\TryLockGuard.h" />
<ClInclude Include="..\..\beast\threads\UnlockGuard.h" />
<ClInclude Include="..\..\beast\threads\WaitableEvent.h" />
<ClInclude Include="..\..\beast\threads\ScopedWrapperContext.h" />
<ClInclude Include="..\..\beast\TypeTraits.h" />
<ClInclude Include="..\..\beast\type_traits\IntegralConstant.h" />
<ClInclude Include="..\..\beast\type_traits\IsIntegral.h" />
<ClInclude Include="..\..\beast\type_traits\IsSigned.h" />
<ClInclude Include="..\..\beast\type_traits\RemoveSigned.h" />
<ClInclude Include="..\..\beast\type_traits\maybe_const.h" />
<ClInclude Include="..\..\beast\Uncopyable.h" />
<ClInclude Include="..\..\beast\Utility.h" />
<ClInclude Include="..\..\beast\utility\Debug.h" />
<ClInclude Include="..\..\beast\utility\EnableIf.h" />
<ClInclude Include="..\..\beast\utility\empty_base_optimization.h" />
<ClInclude Include="..\..\beast\utility\Error.h" />
<ClInclude Include="..\..\beast\utility\hash_pair.h" />
<ClInclude Include="..\..\beast\utility\Journal.h" />
<ClInclude Include="..\..\beast\utility\LeakChecked.h" />
<ClInclude Include="..\..\beast\utility\PropertyStream.h" />
<ClInclude Include="..\..\beast\utility\StaticObject.h" />
<ClInclude Include="..\..\beast\Version.h" />
<ClInclude Include="..\..\config\BeastConfig.h" />
<ClInclude Include="..\..\modules\beast_asio\async\AbstractHandler.h" />
<ClInclude Include="..\..\modules\beast_asio\async\AsyncObject.h" />
<ClInclude Include="..\..\modules\beast_asio\async\ComposedAsyncOperation.h" />
<ClInclude Include="..\..\modules\beast_asio\async\WrapHandler.h" />
<ClInclude Include="..\..\modules\beast_asio\async\SharedHandler.h" />
<ClInclude Include="..\..\modules\beast_asio\async\SharedHandlerAllocator.h" />
<ClInclude Include="..\..\modules\beast_asio\async\SharedHandlerPtr.h" />
<ClInclude Include="..\..\modules\beast_asio\async\SharedHandlerType.h" />
<ClInclude Include="..\..\modules\beast_asio\basics\BufferType.h" />
<ClInclude Include="..\..\modules\beast_asio\basics\ContentBodyBuffer.h" />
<ClInclude Include="..\..\modules\beast_asio\basics\BuffersType.h" />
<ClInclude Include="..\..\modules\beast_asio\basics\FixedInputBuffer.h" />
<ClInclude Include="..\..\modules\beast_asio\basics\PeerRole.h" />
<ClInclude Include="..\..\modules\beast_asio\basics\SharedArg.h" />
@@ -186,7 +259,9 @@
<ClInclude Include="..\..\modules\beast_asio\http\HTTPParserImpl.h" />
<ClInclude Include="..\..\modules\beast_asio\http\HTTPParser.h" />
<ClInclude Include="..\..\modules\beast_asio\http\HTTPRequest.h" />
<ClInclude Include="..\..\modules\beast_asio\http\HTTPRequestParser.h" />
<ClInclude Include="..\..\modules\beast_asio\http\HTTPResponse.h" />
<ClInclude Include="..\..\modules\beast_asio\http\HTTPResponseParser.h" />
<ClInclude Include="..\..\modules\beast_asio\http\HTTPVersion.h" />
<ClInclude Include="..\..\modules\beast_asio\protocol\HandshakeDetectLogic.h" />
<ClInclude Include="..\..\modules\beast_asio\protocol\HandshakeDetectLogicPROXY.h" />
@@ -195,10 +270,6 @@
<ClInclude Include="..\..\modules\beast_asio\protocol\HandshakeDetector.h" />
<ClInclude Include="..\..\modules\beast_asio\protocol\InputParser.h" />
<ClInclude Include="..\..\modules\beast_asio\protocol\PrefilledReadStream.h" />
<ClInclude Include="..\..\modules\beast_asio\sockets\Socket.h" />
<ClInclude Include="..\..\modules\beast_asio\sockets\SocketBase.h" />
<ClInclude Include="..\..\modules\beast_asio\sockets\SocketWrapper.h" />
<ClInclude Include="..\..\modules\beast_asio\sockets\SocketWrapperStrand.h" />
<ClInclude Include="..\..\modules\beast_asio\system\BoostIncludes.h" />
<ClInclude Include="..\..\modules\beast_asio\system\OpenSSLIncludes.h" />
<ClInclude Include="..\..\modules\beast_asio\tests\TestPeer.h" />
@@ -214,29 +285,19 @@
<ClInclude Include="..\..\modules\beast_asio\tests\PeerTest.h" />
<ClInclude Include="..\..\modules\beast_asio\tests\TestPeerType.h" />
<ClInclude Include="..\..\modules\beast_core\beast_core.h" />
<ClInclude Include="..\..\modules\beast_core\containers\AbstractFifo.h" />
<ClInclude Include="..\..\modules\beast_core\containers\Array.h" />
<ClInclude Include="..\..\modules\beast_core\containers\ArrayAllocationBase.h" />
<ClInclude Include="..\..\modules\beast_core\containers\DynamicObject.h" />
<ClInclude Include="..\..\modules\beast_core\containers\ElementComparator.h" />
<ClInclude Include="..\..\modules\beast_core\containers\DynamicArray.h" />
<ClInclude Include="..\..\modules\beast_core\containers\HashMap.h" />
<ClInclude Include="..\..\modules\beast_core\containers\LinkedListPointer.h" />
<ClInclude Include="..\..\modules\beast_core\containers\LockFreeQueue.h" />
<ClInclude Include="..\..\modules\beast_core\containers\NamedValueSet.h" />
<ClInclude Include="..\..\modules\beast_core\containers\OwnedArray.h" />
<ClInclude Include="..\..\modules\beast_core\containers\PropertySet.h" />
<ClInclude Include="..\..\modules\beast_core\containers\SharedObjectArray.h" />
<ClInclude Include="..\..\modules\beast_core\containers\ScopedValueSetter.h" />
<ClInclude Include="..\..\modules\beast_core\containers\SharedTable.h" />
<ClInclude Include="..\..\modules\beast_core\containers\SortedLookupTable.h" />
<ClInclude Include="..\..\modules\beast_core\containers\SortedSet.h" />
<ClInclude Include="..\..\modules\beast_core\containers\SparseSet.h" />
<ClInclude Include="..\..\modules\beast_core\containers\DynamicList.h" />
<ClInclude Include="..\..\modules\beast_core\containers\Variant.h" />
<ClInclude Include="..\..\modules\beast_core\diagnostic\FatalError.h" />
<ClInclude Include="..\..\modules\beast_core\diagnostic\FPUFlags.h" />
<ClInclude Include="..\..\modules\beast_core\diagnostic\LeakChecked.h" />
<ClInclude Include="..\..\modules\beast_core\diagnostic\SemanticVersion.h" />
<ClInclude Include="..\..\modules\beast_core\diagnostic\Throw.h" />
<ClInclude Include="..\..\modules\beast_core\diagnostic\UnitTest.h" />
@@ -254,37 +315,14 @@
<ClInclude Include="..\..\modules\beast_core\logging\FileLogger.h" />
<ClInclude Include="..\..\modules\beast_core\logging\Logger.h" />
<ClInclude Include="..\..\modules\beast_core\maths\BigInteger.h" />
<ClInclude Include="..\..\modules\beast_core\maths\Expression.h" />
<ClInclude Include="..\..\modules\beast_core\maths\Interval.h" />
<ClInclude Include="..\..\modules\beast_core\maths\Math.h" />
<ClInclude Include="..\..\modules\beast_core\maths\MurmurHash.h" />
<ClInclude Include="..\..\modules\beast_core\maths\Random.h" />
<ClInclude Include="..\..\modules\beast_core\maths\Range.h" />
<ClInclude Include="..\..\modules\beast_core\maths\uint24.h" />
<ClInclude Include="..\..\modules\beast_core\memory\AllocatedBy.h" />
<ClInclude Include="..\..\modules\beast_core\memory\AtomicCounter.h" />
<ClInclude Include="..\..\modules\beast_core\memory\AtomicFlag.h" />
<ClInclude Include="..\..\modules\beast_core\memory\AtomicPointer.h" />
<ClInclude Include="..\..\modules\beast_core\memory\AtomicState.h" />
<ClInclude Include="..\..\modules\beast_core\memory\CacheLine.h" />
<ClInclude Include="..\..\modules\beast_core\memory\ContainerDeletePolicy.h" />
<ClInclude Include="..\..\modules\beast_core\memory\FifoFreeStore.h" />
<ClInclude Include="..\..\modules\beast_core\memory\FifoFreeStoreWithoutTLS.h" />
<ClInclude Include="..\..\modules\beast_core\memory\FifoFreeStoreWithTLS.h" />
<ClInclude Include="..\..\modules\beast_core\memory\GlobalFifoFreeStore.h" />
<ClInclude Include="..\..\modules\beast_core\memory\GlobalPagedFreeStore.h" />
<ClInclude Include="..\..\modules\beast_core\memory\MemoryAlignment.h" />
<ClInclude Include="..\..\modules\beast_core\memory\MemoryBlock.h" />
<ClInclude Include="..\..\modules\beast_core\memory\OptionalScopedPointer.h" />
<ClInclude Include="..\..\modules\beast_core\memory\PagedFreeStore.h" />
<ClInclude Include="..\..\modules\beast_core\memory\RecycledObjectPool.h" />
<ClInclude Include="..\..\modules\beast_core\memory\SharedFunction.h" />
<ClInclude Include="..\..\modules\beast_core\memory\SharedObject.h" />
<ClInclude Include="..\..\modules\beast_core\memory\ScopedPointer.h" />
<ClInclude Include="..\..\modules\beast_core\memory\SharedSingleton.h" />
<ClInclude Include="..\..\modules\beast_core\memory\WeakReference.h" />
<ClInclude Include="..\..\modules\beast_core\memory\SharedPtr.h" />
<ClInclude Include="..\..\modules\beast_core\memory\StaticObject.h" />
<ClInclude Include="..\..\modules\beast_core\misc\Main.h" />
<ClInclude Include="..\..\modules\beast_core\misc\Result.h" />
<ClInclude Include="..\..\modules\beast_core\misc\Uuid.h" />
@@ -294,7 +332,6 @@
<ClInclude Include="..\..\modules\beast_core\native\osx_ObjCHelpers.h" />
<ClInclude Include="..\..\modules\beast_core\native\posix_SharedCode.h" />
<ClInclude Include="..\..\modules\beast_core\native\win32_ComSmartPtr.h" />
<ClInclude Include="..\..\modules\beast_core\network\IPAddress.h" />
<ClInclude Include="..\..\modules\beast_core\network\MACAddress.h" />
<ClInclude Include="..\..\modules\beast_core\network\NamedPipe.h" />
<ClInclude Include="..\..\modules\beast_core\network\Socket.h" />
@@ -319,7 +356,6 @@
<ClInclude Include="..\..\modules\beast_core\text\StringArray.h" />
<ClInclude Include="..\..\modules\beast_core\text\StringPairArray.h" />
<ClInclude Include="..\..\modules\beast_core\text\StringPool.h" />
<ClInclude Include="..\..\modules\beast_core\text\TextDiff.h" />
<ClInclude Include="..\..\modules\beast_core\threads\ChildProcess.h" />
<ClInclude Include="..\..\modules\beast_core\threads\CriticalSection.h" />
<ClInclude Include="..\..\modules\beast_core\threads\DynamicLibrary.h" />
@@ -327,26 +363,11 @@
<ClInclude Include="..\..\modules\beast_core\threads\InterProcessLock.h" />
<ClInclude Include="..\..\modules\beast_core\threads\Process.h" />
<ClInclude Include="..\..\modules\beast_core\threads\ReadWriteLock.h" />
<ClInclude Include="..\..\modules\beast_core\threads\ReadWriteMutex.h" />
<ClInclude Include="..\..\modules\beast_core\threads\ScopedLock.h" />
<ClInclude Include="..\..\modules\beast_core\threads\ScopedReadLock.h" />
<ClInclude Include="..\..\modules\beast_core\threads\ScopedWriteLock.h" />
<ClInclude Include="..\..\modules\beast_core\threads\SpinDelay.h" />
<ClInclude Include="..\..\modules\beast_core\threads\SpinLock.h" />
<ClInclude Include="..\..\modules\beast_core\threads\Thread.h" />
<ClInclude Include="..\..\modules\beast_core\threads\ThreadLocalValue.h" />
<ClInclude Include="..\..\modules\beast_core\threads\ThreadPool.h" />
<ClInclude Include="..\..\modules\beast_core\threads\TimeSliceThread.h" />
<ClInclude Include="..\..\modules\beast_core\threads\WaitableEvent.h" />
<ClInclude Include="..\..\modules\beast_core\thread\CallQueue.h" />
<ClInclude Include="..\..\modules\beast_core\thread\DeadlineTimer.h" />
<ClInclude Include="..\..\modules\beast_core\thread\InterruptibleThread.h" />
<ClInclude Include="..\..\modules\beast_core\thread\Listeners.h" />
<ClInclude Include="..\..\modules\beast_core\thread\ManualCallQueue.h" />
<ClInclude Include="..\..\modules\beast_core\thread\Semaphore.h" />
<ClInclude Include="..\..\modules\beast_core\thread\ServiceQueue.h" />
<ClInclude Include="..\..\modules\beast_core\thread\Stoppable.h" />
<ClInclude Include="..\..\modules\beast_core\thread\ThreadWithCallQueue.h" />
<ClInclude Include="..\..\modules\beast_core\thread\Workers.h" />
<ClInclude Include="..\..\modules\beast_core\thread\detail\ScopedLock.h" />
<ClInclude Include="..\..\modules\beast_core\thread\detail\TrackedMutex.h" />
@@ -374,14 +395,6 @@
<ClInclude Include="..\..\modules\beast_core\zip\zlib\zconf.in.h" />
<ClInclude Include="..\..\modules\beast_core\zip\zlib\zlib.h" />
<ClInclude Include="..\..\modules\beast_core\zip\zlib\zutil.h" />
<ClInclude Include="..\..\modules\beast_crypto\beast_crypto.h" />
<ClInclude Include="..\..\modules\beast_crypto\math\BinaryEncoding.h" />
<ClInclude Include="..\..\modules\beast_crypto\math\UnsignedInteger.h" />
<ClInclude Include="..\..\modules\beast_crypto\math\UnsignedIntegerCalc.h" />
<ClInclude Include="..\..\modules\beast_db\beast_db.h" />
<ClInclude Include="..\..\modules\beast_db\keyvalue\KeyvaDB.h" />
<ClInclude Include="..\..\modules\beast_extras\beast_extras.h" />
<ClInclude Include="..\..\modules\beast_extras\traits\BoostLockableTraits.h" />
<ClInclude Include="..\..\modules\beast_sqdb\api\backend.h" />
<ClInclude Include="..\..\modules\beast_sqdb\api\blob.h" />
<ClInclude Include="..\..\modules\beast_sqdb\api\into.h" />
@@ -407,14 +420,77 @@
<ClInclude Include="..\..\modules\beast_sqlite\sqlite\sqlite3ext.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\beast\asio\abstract_socket.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\asio\Asio.cpp" />
<ClCompile Include="..\..\beast\asio\impl\IPAddressConversion.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\boost\Boost.cpp" />
<ClCompile Include="..\..\beast\chrono\Chrono.cpp" />
<ClCompile Include="..\..\beast\chrono\impl\basic_seconds_clock.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\chrono\impl\chrono_io.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\chrono\impl\CPUMeter.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\chrono\impl\abstract_clock.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\chrono\impl\RelativeTime.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\container\Container.cpp" />
<ClCompile Include="..\..\beast\container\impl\aged_associative_container.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\container\tests\buffer_view.test.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\crypto\Crypto.cpp" />
<ClCompile Include="..\..\beast\crypto\impl\BinaryEncoding.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\crypto\impl\MurmurHash.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\crypto\impl\Sha256.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -439,6 +515,19 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\crypto\impl\UnsignedInteger.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\cxx14\cxx14.cpp" />
<ClCompile Include="..\..\beast\cxx14\tests\integer_sequence.test.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\http\HTTP.cpp" />
<ClCompile Include="..\..\beast\http\impl\http_parser.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -482,6 +571,73 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\insight\impl\Collector.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\insight\impl\Group.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\insight\impl\Groups.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\insight\impl\Hook.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\insight\impl\Metric.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\insight\impl\NullCollector.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\insight\impl\StatsDCollector.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\insight\Insight.cpp" />
<ClCompile Include="..\..\beast\net\impl\DynamicBuffer.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\net\impl\IPAddress.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\net\impl\IPAddressV4.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\net\impl\IPAddressV6.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\net\impl\IPEndpoint.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -489,6 +645,13 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\net\Net.cpp" />
<ClCompile Include="..\..\beast\smart_ptr\impl\AbstractObject.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\smart_ptr\SmartPtr.cpp" />
<ClCompile Include="..\..\beast\strings\impl\CharacterFunctions.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -502,6 +665,49 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\strings\Strings.cpp" />
<ClCompile Include="..\..\beast\threads\impl\Atomic.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\threads\impl\RecursiveMutex.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\threads\impl\ServiceQueue.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\threads\impl\Stoppable.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\threads\impl\Thread.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\threads\impl\WaitableEvent.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\threads\Threads.cpp" />
<ClCompile Include="..\..\beast\utility\impl\Assert.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\utility\impl\Debug.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -520,19 +726,25 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\utility\impl\LeakChecked.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\utility\impl\PropertyStream.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\utility\impl\StaticObject.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\beast\utility\Utility.cpp" />
<ClCompile Include="..\..\modules\beast_asio\async\SharedHandler.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_asio\basics\ContentBodyBuffer.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_asio\basics\PeerRole.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -580,12 +792,24 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_asio\http\HTTPRequestParser.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_asio\http\HTTPResponse.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_asio\http\HTTPResponseParser.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_asio\http\HTTPVersion.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -598,18 +822,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_asio\sockets\Socket.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_asio\sockets\SocketBase.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_asio\system\BoostUnitTests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -671,12 +883,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\beast_core.cpp" />
<ClCompile Include="..\..\modules\beast_core\containers\AbstractFifo.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\containers\DynamicObject.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -701,30 +907,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\containers\DynamicArray.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\containers\DynamicList.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\containers\HashMap.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\diagnostic\Assert.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\diagnostic\FatalError.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -735,12 +917,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\diagnostic\LeakChecked.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\diagnostic\SemanticVersion.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -825,60 +1001,18 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\maths\Expression.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\maths\MurmurHash.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\maths\Random.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\memory\FifoFreeStoreWithoutTLS.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\memory\FifoFreeStoreWithTLS.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\memory\GlobalPagedFreeStore.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\memory\MemoryBlock.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\memory\PagedFreeStore.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\memory\StaticObject.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\misc\Main.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -1023,12 +1157,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\network\IPAddress.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\network\MACAddress.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -1137,12 +1265,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\text\TextDiff.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\threads\ChildProcess.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -1161,90 +1283,18 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\threads\ReadWriteMutex.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\threads\SpinDelay.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\threads\Thread.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\threads\ThreadPool.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\threads\TimeSliceThread.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\thread\CallQueue.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\thread\DeadlineTimer.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\thread\InterruptibleThread.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\thread\Listeners.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\thread\ManualCallQueue.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\thread\Semaphore.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\thread\ServiceQueue.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\thread\Stoppable.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\thread\ThreadWithCallQueue.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_core\thread\Workers.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -1371,27 +1421,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_crypto\beast_crypto.cpp" />
<ClCompile Include="..\..\modules\beast_crypto\math\BinaryEncoding.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_crypto\math\UnsignedInteger.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_db\beast_db.cpp" />
<ClCompile Include="..\..\modules\beast_db\keyvalue\KeyvaDB.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_extras\beast_extras.cpp" />
<ClCompile Include="..\..\modules\beast_sqdb\beast_sqdb.cpp" />
<ClCompile Include="..\..\modules\beast_sqdb\source\blob.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -1480,31 +1509,32 @@
<ProjectGuid>{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>beast</RootNamespace>
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
@@ -1536,6 +1566,8 @@
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -1564,6 +1596,8 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@@ -2,13 +2,6 @@
BEAST TODO
--------------------------------------------------------------------------------
- Remove ReadWriteMutex and replace it with a CriticalSection
since the implementation is broken.
- Rewrite SharedData to work with a CriticalSection
- Use new file naming convention
- Use SemanticVersion for beast version numbers to replace BEAST_VERSION
- add support for a __PRETTY_FUNCTION__ equivalent for all environments
@@ -17,13 +10,6 @@ BEAST TODO
- Import secp256k1 from sipa
- HashMap work:
- Add unit test
- Return size_t from hash function, take out upperLimit, move mod % to caller
- Make hash function a functor using operator()
- Implement HardenedHashFunctions
- Fix problem with assigning to the result of operator[] maybe use a proxy?
- Set sqlite thread safety model to '2' in beast_sqlite
- Document and rename all the sqdb files and classes
@@ -60,16 +46,12 @@ BEAST TODO
- Rename malloc/calloc JUCE members that conflict with the debug CRT from MSVC
- Make beast::HashMap support assignment via operator[]
- Reformat every Doxygen comment
- Fix Doxygen metatags
- update Beast Doxyfile
- Rename include guards to boost style, e.g. BEAST_THROW_H_INCLUDED
- Decide if we should get rid of AtomicCounter, AtomicFlag, AtomicPointer, AtomicState
- Clean up CacheLine, StaticObject
- Clean up ConcurrentObject

23
src/beast/beast/Asio.h Normal file
View File

@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
/*
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_ASIO_H_INCLUDED
#define BEAST_ASIO_H_INCLUDED
#endif

View File

@@ -207,6 +207,9 @@ private:
#define BEAST_64BIT_ATOMICS_UNAVAILABLE 1
#endif
#elif BEAST_CLANG && BEAST_LINUX
#define BEAST_ATOMICS_GCC 1
//==============================================================================
#elif BEAST_GCC
#define BEAST_ATOMICS_GCC 1 // GCC with intrinsics
@@ -297,8 +300,16 @@ template <typename Type>
inline Type Atomic<Type>::operator+= (const Type amountToAdd) noexcept
{
#if BEAST_ATOMICS_MAC
# ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wint-to-void-pointer-cast"
# pragma clang diagnostic ignored "-Wint-to-pointer-cast"
# endif
return sizeof (Type) == 4 ? (Type) OSAtomicAdd32Barrier ((int32_t) castTo32Bit (amountToAdd), (BEAST_MAC_ATOMICS_VOLATILE int32_t*) &value)
: (Type) OSAtomicAdd64Barrier ((int64_t) amountToAdd, (BEAST_MAC_ATOMICS_VOLATILE int64_t*) &value);
# ifdef __clang__
# pragma clang diagnostic pop
# endif
#elif BEAST_ATOMICS_WINDOWS
return sizeof (Type) == 4 ? (Type) (beast_InterlockedExchangeAdd ((volatile long*) &value, (long) amountToAdd) + (long) amountToAdd)
: (Type) (beast_InterlockedExchangeAdd64 ((volatile __int64*) &value, (__int64) amountToAdd) + (__int64) amountToAdd);
@@ -317,13 +328,21 @@ template <typename Type>
inline Type Atomic<Type>::operator++() noexcept
{
#if BEAST_ATOMICS_MAC
# ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wint-to-void-pointer-cast"
# pragma clang diagnostic ignored "-Wint-to-pointer-cast"
# endif
return sizeof (Type) == 4 ? (Type) OSAtomicIncrement32Barrier ((BEAST_MAC_ATOMICS_VOLATILE int32_t*) &value)
: (Type) OSAtomicIncrement64Barrier ((BEAST_MAC_ATOMICS_VOLATILE int64_t*) &value);
# ifdef __clang__
# pragma clang diagnostic pop
# endif
#elif BEAST_ATOMICS_WINDOWS
return sizeof (Type) == 4 ? (Type) beast_InterlockedIncrement ((volatile long*) &value)
: (Type) beast_InterlockedIncrement64 ((volatile __int64*) &value);
#elif BEAST_ATOMICS_GCC
return (Type) __sync_add_and_fetch (&value, 1);
return (Type) __sync_add_and_fetch (&value, (Type) 1);
#endif
}
@@ -331,13 +350,21 @@ template <typename Type>
inline Type Atomic<Type>::operator--() noexcept
{
#if BEAST_ATOMICS_MAC
# ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wint-to-void-pointer-cast"
# pragma clang diagnostic ignored "-Wint-to-pointer-cast"
# endif
return sizeof (Type) == 4 ? (Type) OSAtomicDecrement32Barrier ((BEAST_MAC_ATOMICS_VOLATILE int32_t*) &value)
: (Type) OSAtomicDecrement64Barrier ((BEAST_MAC_ATOMICS_VOLATILE int64_t*) &value);
# ifdef __clang__
# pragma clang diagnostic pop
# endif
#elif BEAST_ATOMICS_WINDOWS
return sizeof (Type) == 4 ? (Type) beast_InterlockedDecrement ((volatile long*) &value)
: (Type) beast_InterlockedDecrement64 ((volatile __int64*) &value);
#elif BEAST_ATOMICS_GCC
return (Type) __sync_add_and_fetch (&value, -1);
return (Type) __sync_add_and_fetch (&value, (Type) -1);
#endif
}

View File

@@ -17,12 +17,11 @@
*/
//==============================================================================
#ifndef BEAST_THREAD_H_INCLUDED
#define BEAST_THREAD_H_INCLUDED
#ifndef BEAST_BOOST_H_INCLUDED
#define BEAST_BOOST_H_INCLUDED
#include "thread/LockGuard.h"
#include "thread/SharedLockGuard.h"
#include "thread/SharedMutexAdapter.h"
#include "thread/SharedData.h"
// These classes require boost in order to be used.
#include "boost/ErrorCode.h"
#endif

View File

@@ -20,6 +20,15 @@
#ifndef BEAST_CHRONO_H_INCLUDED
#define BEAST_CHRONO_H_INCLUDED
#include "chrono/abstract_clock.h"
#include "chrono/basic_seconds_clock.h"
#include "chrono/chrono_io.h"
#include "chrono/chrono_util.h"
#include "chrono/manual_clock.h"
#include "chrono/ratio_io.h"
#include "chrono/CPUMeter.h"
#include "chrono/RelativeTime.h"
#include "chrono/ScopedTimeInterval.h"
#endif

View File

@@ -20,7 +20,11 @@
#ifndef BEAST_CRYPTO_H_INCLUDED
#define BEAST_CRYPTO_H_INCLUDED
#include "crypto/BinaryEncoding.h"
#include "crypto/MurmurHash.h"
#include "crypto/Sha256.h"
#include "crypto/UnsignedInteger.h"
#include "crypto/UnsignedIntegerCalc.h"
#endif

View File

@@ -139,7 +139,8 @@ bool operator!= (FixedArray <T, N> const& lhs, FixedArray <T, N> const& rhs)
template <class T, std::size_t N>
bool operator< (FixedArray <T, N> const& lhs, FixedArray <T, N> const& rhs)
{
return std::lexicographical_compare (lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
return std::lexicographical_compare (
lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
template <class T, std::size_t N>

37
src/beast/beast/Insight.h Normal file
View File

@@ -0,0 +1,37 @@
//------------------------------------------------------------------------------
/*
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_INSIGHT_H_INCLUDED
#define BEAST_INSIGHT_H_INCLUDED
#include "insight/Counter.h"
#include "insight/CounterImpl.h"
#include "insight/Event.h"
#include "insight/EventImpl.h"
#include "insight/Gauge.h"
#include "insight/GaugeImpl.h"
#include "insight/Group.h"
#include "insight/Groups.h"
#include "insight/Hook.h"
#include "insight/HookImpl.h"
#include "insight/Collector.h"
#include "insight/NullCollector.h"
#include "insight/StatsDCollector.h"
#endif

View File

@@ -20,8 +20,6 @@
#ifndef BEAST_INTRUSIVE_H_INCLUDED
#define BEAST_INTRUSIVE_H_INCLUDED
#include "intrusive/ForwardList.h"
#include "intrusive/IntrusiveArray.h"
#include "intrusive/List.h"
#include "intrusive/LockFreeStack.h"

View File

@@ -20,14 +20,6 @@
#ifndef BEAST_MPL_H_INCLUDED
#define BEAST_MPL_H_INCLUDED
#include "mpl/AddConst.h"
#include "mpl/CopyConst.h"
#include "mpl/IfCond.h"
#include "mpl/IsCallPossible.h"
#include "mpl/PointerToOther.h"
#include "mpl/RemoveConst.h"
#include "mpl/RemoveConstVolatile.h"
#include "mpl/RemoveReference.h"
#include "mpl/RemoveVolatile.h"
#endif

View File

@@ -27,6 +27,7 @@
#include <cstring>
#include "Config.h"
#include "Uncopyable.h"
namespace beast {

View File

@@ -20,6 +20,12 @@
#ifndef BEAST_NET_H_INCLUDED
#define BEAST_NET_H_INCLUDED
#include "net/BufferType.h"
#include "net/DynamicBuffer.h"
#include "net/IPEndpoint.h"
#include "net/IPAddressV4.h"
#include "net/IPAddressV6.h"
#include "net/IPEndpoint.h"
#endif

View File

@@ -0,0 +1,31 @@
//------------------------------------------------------------------------------
/*
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_SMARTPTR_H_INCLUDED
#define BEAST_SMARTPTR_H_INCLUDED
#include "Config.h"
#include "smart_ptr/AbstractObject.h"
#include "smart_ptr/ContainerDeletePolicy.h"
#include "smart_ptr/SharedObject.h"
#include "smart_ptr/SharedPtr.h"
#include "smart_ptr/ScopedPointer.h"
#endif

39
src/beast/beast/Threads.h Normal file
View File

@@ -0,0 +1,39 @@
//------------------------------------------------------------------------------
/*
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_THREADS_H_INCLUDED
#define BEAST_THREADS_H_INCLUDED
#include "threads/LockGuard.h"
#include "threads/UnlockGuard.h"
#include "threads/TryLockGuard.h"
#include "threads/SharedLockGuard.h"
#include "threads/SharedMutexAdapter.h"
#include "threads/SharedData.h"
#include "threads/ServiceQueue.h"
#include "threads/SpinLock.h"
#include "threads/Stoppable.h"
#include "threads/Thread.h"
#include "threads/ThreadLocalValue.h"
#include "threads/WaitableEvent.h"
#include "threads/ScopedWrapperContext.h"
#include "threads/semaphore.h"
#endif

View File

@@ -23,6 +23,5 @@
#include "type_traits/IntegralConstant.h"
#include "type_traits/IsIntegral.h"
#include "type_traits/IsSigned.h"
#include "type_traits/RemoveSigned.h"
#endif

View File

@@ -21,9 +21,13 @@
#define BEAST_UTILITY_H_INCLUDED
#include "utility/Debug.h"
#include "utility/EnableIf.h"
#include "utility/Error.h"
#include "utility/Journal.h"
#include "utility/LeakChecked.h"
#include "utility/PropertyStream.h"
#include "utility/StaticObject.h"
#include "utility/hash_pair.h"
#endif

View File

@@ -0,0 +1,28 @@
//------------------------------------------------------------------------------
/*
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 "BeastConfig.h"
#include "impl/IPAddressConversion.cpp"
#include "tests/wrap_handler_tests.cpp"
#include "tests/bind_handler_tests.cpp"
#include "tests/shared_handler_tests.cpp"
#include "abstract_socket.cpp" // TEMPORARY!

View File

@@ -0,0 +1,68 @@
//------------------------------------------------------------------------------
/*
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_ASIO_IPADDRESSCONVERSION_H_INCLUDED
#define BEAST_ASIO_IPADDRESSCONVERSION_H_INCLUDED
#include "../net/IPEndpoint.h"
#include <sstream>
#include <boost/asio.hpp>
namespace beast {
namespace IP {
/** Convert to Endpoint.
The port is set to zero.
*/
Endpoint from_asio (boost::asio::ip::address const& address);
/** Convert to Endpoint. */
Endpoint from_asio (boost::asio::ip::tcp::endpoint const& endpoint);
/** Convert to asio::ip::address.
The port is ignored.
*/
boost::asio::ip::address to_asio_address (Endpoint const& endpoint);
/** Convert to asio::ip::tcp::endpoint. */
boost::asio::ip::tcp::endpoint to_asio_endpoint (Endpoint const& endpoint);
}
}
namespace beast {
// DEPRECATED
struct IPAddressConversion
{
static IP::Endpoint from_asio (boost::asio::ip::address const& address)
{ return IP::from_asio (address); }
static IP::Endpoint from_asio (boost::asio::ip::tcp::endpoint const& endpoint)
{ return IP::from_asio (endpoint); }
static boost::asio::ip::address to_asio_address (IP::Endpoint const& address)
{ return IP::to_asio_address (address); }
static boost::asio::ip::tcp::endpoint to_asio_endpoint (IP::Endpoint const& address)
{ return IP::to_asio_endpoint (address); }
};
}
#endif

View File

@@ -0,0 +1,217 @@
//------------------------------------------------------------------------------
/*
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 "abstract_socket.h"
#include "bind_handler.h"
namespace beast {
namespace asio {
#if ! BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES
//------------------------------------------------------------------------------
//
// Socket
//
//------------------------------------------------------------------------------
void* abstract_socket::this_layer_ptr (char const*) const
{
pure_virtual_called ();
return nullptr;
}
//------------------------------------------------------------------------------
//
// native_handle
//
//------------------------------------------------------------------------------
bool abstract_socket::native_handle (char const*, void*)
{
pure_virtual_called ();
return false;
}
//------------------------------------------------------------------------------
//
// basic_io_object
//
//------------------------------------------------------------------------------
boost::asio::io_service& abstract_socket::get_io_service ()
{
pure_virtual_called ();
return *static_cast <boost::asio::io_service*>(nullptr);
}
//------------------------------------------------------------------------------
//
// basic_socket
//
//------------------------------------------------------------------------------
void*
abstract_socket::lowest_layer_ptr (char const*) const
{
pure_virtual_called ();
return nullptr;
}
auto
abstract_socket::cancel (boost::system::error_code& ec) -> error_code
{
return pure_virtual_error (ec);
}
auto
abstract_socket::shutdown (shutdown_type, boost::system::error_code& ec) -> error_code
{
return pure_virtual_error (ec);
}
auto
abstract_socket::close (boost::system::error_code& ec) -> error_code
{
return pure_virtual_error (ec);
}
//------------------------------------------------------------------------------
//
// basic_socket_acceptor
//
//------------------------------------------------------------------------------
auto
abstract_socket::accept (abstract_socket&, error_code& ec) -> error_code
{
return pure_virtual_error (ec);
}
void
abstract_socket::async_accept (abstract_socket&, error_handler handler)
{
get_io_service ().post (bind_handler (
handler, pure_virtual_error()));
}
//------------------------------------------------------------------------------
//
// basic_stream_socket
//
//------------------------------------------------------------------------------
std::size_t
abstract_socket::read_some (mutable_buffers, error_code& ec)
{
ec = pure_virtual_error ();
return 0;
}
std::size_t
abstract_socket::write_some (const_buffers, error_code& ec)
{
ec = pure_virtual_error ();
return 0;
}
void
abstract_socket::async_read_some (mutable_buffers, transfer_handler handler)
{
get_io_service ().post (bind_handler (
handler, pure_virtual_error(), 0));
}
void
abstract_socket::async_write_some (const_buffers, transfer_handler handler)
{
get_io_service ().post (bind_handler (
handler, pure_virtual_error(), 0));
}
//------------------------------------------------------------------------------
//
// ssl::stream
//
//------------------------------------------------------------------------------
void*
abstract_socket::next_layer_ptr (char const*) const
{
pure_virtual_called ();
return nullptr;
}
bool
abstract_socket::needs_handshake ()
{
return false;
}
void
abstract_socket::set_verify_mode (int)
{
pure_virtual_called ();
}
auto
abstract_socket::handshake (handshake_type, error_code& ec) -> error_code
{
return pure_virtual_error (ec);
}
void
abstract_socket::async_handshake (handshake_type, error_handler handler)
{
get_io_service ().post (bind_handler (
handler, pure_virtual_error()));
}
auto
abstract_socket::handshake (handshake_type, const_buffers, error_code& ec) ->
error_code
{
return pure_virtual_error (ec);
}
void
abstract_socket::async_handshake (handshake_type, const_buffers,
transfer_handler handler)
{
get_io_service ().post (bind_handler (
handler, pure_virtual_error(), 0));
}
auto
abstract_socket::shutdown (error_code& ec) -> error_code
{
return pure_virtual_error (ec);
}
void
abstract_socket::async_shutdown (error_handler handler)
{
get_io_service ().post (bind_handler (
handler, pure_virtual_error()));
}
#endif
}
}

View File

@@ -17,8 +17,28 @@
*/
//==============================================================================
#ifndef BEAST_ASIO_SOCKETS_SOCKET_H_INCLUDED
#define BEAST_ASIO_SOCKETS_SOCKET_H_INCLUDED
#ifndef BEAST_ASIO_ABSTRACT_SOCKET_H_INCLUDED
#define BEAST_ASIO_ABSTRACT_SOCKET_H_INCLUDED
#include "buffer_sequence.h"
#include "shared_handler.h"
#include <boost/asio/socket_base.hpp>
#include <boost/asio/ssl/stream_base.hpp>
// Checking overrides replaces unimplemented stubs with pure virtuals
#ifndef BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES
# define BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES 1
#endif
#if BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES
# define BEAST_SOCKET_VIRTUAL = 0
#else
# define BEAST_SOCKET_VIRTUAL
#endif
namespace beast {
namespace asio {
/** A high level socket abstraction.
@@ -29,18 +49,61 @@
When member functions are called and the underlying implementation does
not support the operation, a fatal error is generated.
*/
class Socket
: public SocketBase
, public boost::asio::ssl::stream_base
class abstract_socket
: public boost::asio::ssl::stream_base
, public boost::asio::socket_base
{
protected:
typedef boost::system::error_code error_code;
typedef asio::shared_handler <void (void)> post_handler;
typedef asio::shared_handler <void (error_code)> error_handler;
typedef asio::shared_handler <
void (error_code, std::size_t)> transfer_handler;
static
void
pure_virtual_called()
{
throw std::runtime_error ("pure virtual called");
}
static
error_code
pure_virtual_error ()
{
pure_virtual_called();
return boost::system::errc::make_error_code (
boost::system::errc::function_not_supported);
}
static
error_code
pure_virtual_error (error_code& ec)
{
return ec = pure_virtual_error();
}
static
void
throw_if (error_code const& ec)
{
if (ec)
throw boost::system::system_error (ec);
}
public:
virtual ~Socket ();
virtual ~abstract_socket ()
{
}
//--------------------------------------------------------------------------
//
// Socket
// abstract_socket
//
//--------------------------------------------------------------------------
/** Retrieve the underlying object.
@@ -48,32 +111,32 @@ public:
exception is thrown if trying to acquire a reference.
*/
/** @{ */
template <typename Object>
template <class Object>
Object& this_layer ()
{
Object* object (this->this_layer_ptr <Object> ());
if (object == nullptr)
Throw (std::bad_cast (), __FILE__, __LINE__);
throw std::bad_cast ();
return *object;
}
template <typename Object>
template <class Object>
Object const& this_layer () const
{
Object const* object (this->this_layer_ptr <Object> ());
if (object == nullptr)
Throw (std::bad_cast (), __FILE__, __LINE__);
throw std::bad_cast ();
return *object;
}
template <typename Object>
template <class Object>
Object* this_layer_ptr ()
{
return static_cast <Object*> (
this->this_layer_ptr (typeid (Object).name ()));
}
template <typename Object>
template <class Object>
Object const* this_layer_ptr () const
{
return static_cast <Object const*> (
@@ -88,6 +151,7 @@ public:
//
// native_handle
//
//--------------------------------------------------------------------------
/** Retrieve the native representation of the object.
@@ -101,7 +165,7 @@ public:
void native_handle (Handle* dest)
{
if (! native_handle (typeid (Handle).name (), dest))
Throw (std::bad_cast (), __FILE__, __LINE__);
throw std::bad_cast ();
}
virtual bool native_handle (char const* type_name, void* dest)
@@ -111,6 +175,7 @@ public:
//
// basic_io_object
//
//--------------------------------------------------------------------------
virtual boost::asio::io_service& get_io_service ()
BEAST_SOCKET_VIRTUAL;
@@ -119,6 +184,7 @@ public:
//
// basic_socket
//
//--------------------------------------------------------------------------
/** Retrieve the lowest layer object.
@@ -126,32 +192,32 @@ public:
exception is thrown if trying to acquire a reference.
*/
/** @{ */
template <typename Object>
template <class Object>
Object& lowest_layer ()
{
Object* object (this->lowest_layer_ptr <Object> ());
if (object == nullptr)
Throw (std::bad_cast (), __FILE__, __LINE__);
throw std::bad_cast ();
return *object;
}
template <typename Object>
template <class Object>
Object const& lowest_layer () const
{
Object const* object (this->lowest_layer_ptr <Object> ());
if (object == nullptr)
Throw (std::bad_cast (), __FILE__, __LINE__);
throw std::bad_cast ();
return *object;
}
template <typename Object>
template <class Object>
Object* lowest_layer_ptr ()
{
return static_cast <Object*> (
this->lowest_layer_ptr (typeid (Object).name ()));
}
template <typename Object>
template <class Object>
Object const* lowest_layer_ptr () const
{
return static_cast <Object const*> (
@@ -167,7 +233,8 @@ public:
void cancel ()
{
error_code ec;
throw_error (cancel (ec), __FILE__, __LINE__);
cancel (ec);
throw_if (ec);
}
virtual error_code cancel (error_code& ec)
@@ -176,7 +243,8 @@ public:
void shutdown (shutdown_type what)
{
error_code ec;
throw_error (shutdown (what, ec), __FILE__, __LINE__);
shutdown (what, ec);
throw_if (ec);
}
virtual error_code shutdown (shutdown_type what,
@@ -186,7 +254,8 @@ public:
void close ()
{
error_code ec;
throw_error (close (ec), __FILE__, __LINE__);
close (ec);
throw_if (ec);
}
virtual error_code close (error_code& ec)
@@ -196,82 +265,39 @@ public:
//
// basic_socket_acceptor
//
//--------------------------------------------------------------------------
virtual error_code accept (Socket& peer, error_code& ec)
virtual error_code accept (abstract_socket& peer, error_code& ec)
BEAST_SOCKET_VIRTUAL;
template <typename AcceptHandler>
void async_accept (Socket& peer, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler)
{
return async_accept (peer,
newAcceptHandler (BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)));
}
virtual void async_accept (Socket& peer, SharedHandlerPtr handler)
virtual void async_accept (abstract_socket& peer, error_handler handler)
BEAST_SOCKET_VIRTUAL;
//--------------------------------------------------------------------------
//
// basic_stream_socket
//
//--------------------------------------------------------------------------
// SyncReadStream
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/SyncReadStream.html
//
template <typename MutableBufferSequence>
std::size_t read_some (MutableBufferSequence const& buffers,
error_code& ec)
{
return read_some (MutableBuffers (buffers), ec);
}
virtual std::size_t read_some (MutableBuffers const& buffers, error_code& ec)
virtual std::size_t read_some (mutable_buffers buffers, error_code& ec)
BEAST_SOCKET_VIRTUAL;
// SyncWriteStream
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/SyncWriteStream.html
//
template <typename ConstBufferSequence>
std::size_t write_some (ConstBufferSequence const& buffers, error_code &ec)
{
return write_some (ConstBuffers (buffers), ec);
}
virtual std::size_t write_some (ConstBuffers const& buffers, error_code& ec)
virtual std::size_t write_some (const_buffers buffers, error_code& ec)
BEAST_SOCKET_VIRTUAL;
// AsyncReadStream
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/AsyncReadStream.html
//
template <typename MutableBufferSequence, typename ReadHandler>
void async_read_some (MutableBufferSequence const& buffers,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
return async_read_some (MutableBuffers (buffers),
newReadHandler (BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)));
}
virtual void async_read_some (MutableBuffers const& buffers, SharedHandlerPtr handler)
virtual void async_read_some (mutable_buffers buffers,
transfer_handler handler)
BEAST_SOCKET_VIRTUAL;
// AsyncWriteStream
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/AsyncWriteStream.html
//
template <typename ConstBufferSequence, typename WriteHandler>
void async_write_some (ConstBufferSequence const& buffers,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
{
return async_write_some (ConstBuffers (buffers),
newWriteHandler (BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)));
}
virtual void async_write_some (ConstBuffers const& buffers, SharedHandlerPtr handler)
virtual void async_write_some (const_buffers buffers,
transfer_handler handler)
BEAST_SOCKET_VIRTUAL;
//--------------------------------------------------------------------------
//
// ssl::stream
//
//--------------------------------------------------------------------------
/** Retrieve the next layer object.
@@ -279,32 +305,32 @@ public:
exception is thrown if trying to acquire a reference.
*/
/** @{ */
template <typename Object>
template <class Object>
Object& next_layer ()
{
Object* object (this->next_layer_ptr <Object> ());
if (object == nullptr)
Throw (std::bad_cast (), __FILE__, __LINE__);
throw std::bad_cast ();
return *object;
}
template <typename Object>
template <class Object>
Object const& next_layer () const
{
Object const* object (this->next_layer_ptr <Object> ());
if (object == nullptr)
Throw (std::bad_cast (), __FILE__, __LINE__);
throw std::bad_cast ();
return *object;
}
template <typename Object>
template <class Object>
Object* next_layer_ptr ()
{
return static_cast <Object*> (
this->next_layer_ptr (typeid (Object).name ()));
}
template <typename Object>
template <class Object>
Object const* next_layer_ptr () const
{
return static_cast <Object const*> (
@@ -330,107 +356,49 @@ public:
virtual bool needs_handshake ()
BEAST_SOCKET_VIRTUAL;
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__verify_mode.html
//
virtual void set_verify_mode (int verify_mode) = 0;
virtual void set_verify_mode (int verify_mode)
BEAST_SOCKET_VIRTUAL;
// ssl::stream::handshake (1 of 4)
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/handshake/overload1.html
//
void handshake (handshake_type type)
{
error_code ec;
throw_error (handshake (type, ec), __FILE__, __LINE__);
handshake (type, ec);
throw_if (ec);
}
// ssl::stream::handshake (2 of 4)
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/handshake/overload2.html
//
virtual error_code handshake (handshake_type type, error_code& ec)
BEAST_SOCKET_VIRTUAL;
// ssl::stream::async_handshake (1 of 2)
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/async_handshake/overload1.html
//
template <typename HandshakeHandler>
void async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler)
{
return async_handshake (type,
newHandshakeHandler (BOOST_ASIO_MOVE_CAST(HandshakeHandler)(handler)));
}
virtual void async_handshake (handshake_type type, SharedHandlerPtr handler)
virtual void async_handshake (handshake_type type, error_handler handler)
BEAST_SOCKET_VIRTUAL;
//--------------------------------------------------------------------------
#if BEAST_ASIO_HAS_BUFFEREDHANDSHAKE
// ssl::stream::handshake (3 of 4)
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/handshake/overload3.html
//
template <typename ConstBufferSequence>
void handshake (handshake_type type, ConstBufferSequence const& buffers)
{
error_code ec;
throw_error (handshake (type, buffers, ec), __FILE__, __LINE__);
}
// ssl::stream::handshake (4 of 4)
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/handshake/overload4.html
//
template <typename ConstBufferSequence>
error_code handshake (handshake_type type,
ConstBufferSequence const& buffers, error_code& ec)
{
return handshake (type, ConstBuffers (buffers), ec);
}
virtual error_code handshake (handshake_type type,
ConstBuffers const& buffers, error_code& ec)
BEAST_SOCKET_VIRTUAL;
const_buffers buffers, error_code& ec)
BEAST_SOCKET_VIRTUAL;
// ssl::stream::async_handshake (2 of 2)
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/async_handshake/overload2.html
//
template <typename ConstBufferSequence, typename BufferedHandshakeHandler>
void async_handshake (handshake_type type, ConstBufferSequence const& buffers,
BOOST_ASIO_MOVE_ARG(BufferedHandshakeHandler) handler)
{
return async_handshake (type, ConstBuffers (buffers),
newBufferedHandshakeHandler (BOOST_ASIO_MOVE_CAST(BufferedHandshakeHandler)(handler)));
}
virtual void async_handshake (handshake_type type, ConstBuffers const& buffers,
SharedHandlerPtr handler)
BEAST_SOCKET_VIRTUAL;
#endif
virtual void async_handshake (handshake_type type,
const_buffers buffers, transfer_handler handler)
BEAST_SOCKET_VIRTUAL;
//--------------------------------------------------------------------------
// ssl::stream::shutdown
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/shutdown.html
//
void shutdown ()
{
error_code ec;
throw_error (shutdown (ec), __FILE__, __LINE__);
shutdown (ec);
throw_if (ec);
}
virtual error_code shutdown (error_code& ec)
BEAST_SOCKET_VIRTUAL;
// ssl::stream::async_shutdown
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/async_shutdown.html
//
template <typename ShutdownHandler>
void async_shutdown (BOOST_ASIO_MOVE_ARG(ShutdownHandler) handler)
{
return async_shutdown (
newShutdownHandler (BOOST_ASIO_MOVE_CAST(ShutdownHandler)(handler)));
}
virtual void async_shutdown (SharedHandlerPtr handler)
virtual void async_shutdown (error_handler handler)
BEAST_SOCKET_VIRTUAL;
};
}
}
#endif

View File

@@ -0,0 +1,163 @@
//------------------------------------------------------------------------------
/*
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_ASIO_BIND_HANDLER_H_INCLUDED
#define BEAST_ASIO_BIND_HANDLER_H_INCLUDED
#include <boost/asio/detail/handler_alloc_helpers.hpp>
#include <boost/asio/detail/handler_cont_helpers.hpp>
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#include <functional>
#include "../cxx14/type_traits.h" // <type_traits>
#include "../cxx14/utility.h" // <utility>
namespace beast {
namespace asio {
namespace detail {
/** Nullary handler that calls Handler with bound arguments.
The rebound handler provides the same io_service execution
guarantees as the original handler.
*/
template <class DeducedHandler, class... Args>
class bound_handler
{
private:
typedef std::tuple <std::decay_t <Args>...> args_type;
std::decay_t <DeducedHandler> m_handler;
args_type m_args;
template <class Handler, class Tuple, std::size_t... S>
static void invoke (Handler& h, Tuple& args,
std::index_sequence <S...>)
{
h (std::get <S> (args)...);
}
public:
typedef void result_type;
bound_handler (DeducedHandler&& handler, Args&&... args)
: m_handler (std::forward <DeducedHandler> (handler))
, m_args (std::forward <Args> (args)...)
{
}
void
operator() ()
{
invoke (m_handler, m_args,
std::index_sequence_for <Args...> ());
}
void
operator() () const
{
invoke (m_handler, m_args,
std::index_sequence_for <Args...> ());
}
template <class Function>
friend
void
asio_handler_invoke (Function& f, bound_handler* h)
{
boost_asio_handler_invoke_helpers::
invoke (f, h->m_handler);
}
template <class Function>
friend
void
asio_handler_invoke (Function const& f, bound_handler* h)
{
boost_asio_handler_invoke_helpers::
invoke (f, h->m_handler);
}
friend
void*
asio_handler_allocate (std::size_t size, bound_handler* h)
{
return boost_asio_handler_alloc_helpers::
allocate (size, h->m_handler);
}
friend
void
asio_handler_deallocate (void* p, std::size_t size, bound_handler* h)
{
boost_asio_handler_alloc_helpers::
deallocate (p, size, h->m_handler);
}
friend
bool
asio_handler_is_continuation (bound_handler* h)
{
return boost_asio_handler_cont_helpers::
is_continuation (h->m_handler);
}
};
}
//------------------------------------------------------------------------------
/** Binds parameters to a handler to produce a nullary functor.
The returned handler provides the same io_service execution guarantees
as the original handler. This is designed to use as a replacement for
io_service::wrap, to ensure that the handler will not be invoked
immediately by the calling function.
*/
template <class DeducedHandler, class... Args>
detail::bound_handler <DeducedHandler, Args...>
bind_handler (DeducedHandler&& handler, Args&&... args)
{
return detail::bound_handler <DeducedHandler, Args...> (
std::forward <DeducedHandler> (handler),
std::forward <Args> (args)...);
}
}
}
//------------------------------------------------------------------------------
namespace std {
template <class Handler, class... Args>
void bind (beast::asio::detail::bound_handler <
Handler, Args...>, ...) = delete;
#if 0
template <class Handler, class... Args>
struct is_bind_expression <
beast::asio::detail::bound_handler <Handler, Args...>
> : std::true_type
{
};
#endif
}
#endif

View File

@@ -0,0 +1,110 @@
//------------------------------------------------------------------------------
/*
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_ASIO_BUFFER_SEQUENCE_H_INCLUDED
#define BEAST_ASIO_BUFFER_SEQUENCE_H_INCLUDED
#include <boost/asio/buffer.hpp>
#include <algorithm>
#include <iterator>
#include "../cxx14/type_traits.h" // <type_traits>
#include <vector>
namespace beast {
namespace asio {
template <class Buffer>
class buffer_sequence
{
private:
typedef std::vector <Buffer> sequence_type;
public:
typedef Buffer value_type;
typedef typename sequence_type::const_iterator const_iterator;
private:
sequence_type m_buffers;
template <class FwdIter>
void assign (FwdIter first, FwdIter last)
{
m_buffers.clear();
m_buffers.reserve (std::distance (first, last));
for (;first != last; ++first)
m_buffers.push_back (*first);
}
public:
buffer_sequence ()
{
}
template <
class BufferSequence,
class = std::enable_if_t <std::is_constructible <
Buffer, typename BufferSequence::value_type>::value>
>
buffer_sequence (BufferSequence const& s)
{
assign (std::begin (s), std::end (s));
}
template <
class FwdIter,
class = std::enable_if_t <std::is_constructible <
Buffer, typename std::iterator_traits <
FwdIter>::value_type>::value>
>
buffer_sequence (FwdIter first, FwdIter last)
{
assign (first, last);
}
template <class BufferSequence>
std::enable_if_t <std::is_constructible <
Buffer, typename BufferSequence::value_type>::value,
buffer_sequence&
>
operator= (BufferSequence const& s)
{
return assign (s);
}
const_iterator
begin () const noexcept
{
return m_buffers.begin ();
}
const_iterator
end () const noexcept
{
return m_buffers.end ();
}
};
typedef buffer_sequence <boost::asio::const_buffer> const_buffers;
typedef buffer_sequence <boost::asio::mutable_buffer> mutable_buffers;
}
}
#endif

View File

@@ -0,0 +1,67 @@
//------------------------------------------------------------------------------
/*
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 "../IPAddressConversion.h"
namespace beast {
namespace IP {
Endpoint from_asio (boost::asio::ip::address const& address)
{
if (address.is_v4 ())
{
boost::asio::ip::address_v4::bytes_type const bytes (
address.to_v4().to_bytes());
return Endpoint (AddressV4 (
bytes [0], bytes [1], bytes [2], bytes [3]));
}
// VFALCO TODO IPv6 support
bassertfalse;
return Endpoint();
}
Endpoint from_asio (boost::asio::ip::tcp::endpoint const& endpoint)
{
return from_asio (endpoint.address()).at_port (endpoint.port());
}
boost::asio::ip::address to_asio_address (Endpoint const& endpoint)
{
if (endpoint.address().is_v4())
{
return boost::asio::ip::address (
boost::asio::ip::address_v4 (
endpoint.address().to_v4().value));
}
// VFALCO TODO IPv6 support
bassertfalse;
return boost::asio::ip::address (
boost::asio::ip::address_v6 ());
}
boost::asio::ip::tcp::endpoint to_asio_endpoint (Endpoint const& endpoint)
{
return boost::asio::ip::tcp::endpoint (
to_asio_address (endpoint), endpoint.port());
}
}
}

View File

@@ -0,0 +1,245 @@
//------------------------------------------------------------------------------
/*
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_ASIO_IO_LATENCY_PROBE_H_INCLUDED
#define BEAST_ASIO_IO_LATENCY_PROBE_H_INCLUDED
#include <chrono>
#include <condition_variable>
#include <mutex>
#include <stdexcept>
#include <boost/asio/deadline_timer.hpp>
#include <boost/asio/io_service.hpp>
#include <boost/config.hpp>
namespace beast {
/** Measures handler latency on an io_service queue. */
template <class Clock>
class io_latency_probe
{
private:
typedef typename Clock::duration duration;
typedef typename Clock::time_point time_point;
std::recursive_mutex m_mutex;
std::condition_variable_any m_cond;
std::size_t m_count;
duration const m_period;
boost::asio::io_service& m_ios;
boost::asio::deadline_timer m_timer;
bool m_cancel;
public:
io_latency_probe (duration const& period,
boost::asio::io_service& ios)
: m_count (1)
, m_period (period)
, m_ios (ios)
, m_timer (m_ios)
, m_cancel (false)
{
}
~io_latency_probe ()
{
std::unique_lock <decltype (m_mutex)> lock (m_mutex);
cancel (lock, true);
}
/** Return the io_service associated with the latency probe. */
/** @{ */
boost::asio::io_service& get_io_service ()
{
return m_ios;
}
boost::asio::io_service const& get_io_service () const
{
return m_ios;
}
/** @} */
/** Cancel all pending i/o.
Any handlers which have already been queued will still be called.
*/
/** @{ */
void cancel ()
{
std::unique_lock <decltype(m_mutex)> lock (m_mutex);
cancel (lock, true);
}
void cancel_async ()
{
std::unique_lock <decltype(m_mutex)> lock (m_mutex);
cancel (lock, false);
}
/** @} */
/** Measure one sample of i/o latency.
Handler will be called with this signature:
void Handler (Duration d);
*/
template <class Handler>
void sample_one (Handler&& handler)
{
std::lock_guard <decltype(m_mutex)> lock (m_mutex);
if (m_cancel)
throw std::logic_error ("io_latency_probe is canceled");
m_ios.post (sample_op <Handler> (
std::forward <Handler> (handler),
Clock::now(), false, this));
}
/** Initiate continuous i/o latency sampling.
Handler will be called with this signature:
void Handler (std::chrono::milliseconds);
*/
template <class Handler>
void sample (Handler&& handler)
{
std::lock_guard <decltype(m_mutex)> lock (m_mutex);
if (m_cancel)
throw std::logic_error ("io_latency_probe is canceled");
m_ios.post (sample_op <Handler> (
std::forward <Handler> (handler),
Clock::now(), true, this));
}
private:
void cancel (std::unique_lock <decltype (m_mutex)>& lock,
bool wait)
{
if (! m_cancel)
{
--m_count;
m_cancel = true;
}
if (wait)
#ifdef BOOST_NO_CXX11_LAMBDAS
while (m_count != 0)
m_cond.wait (lock);
#else
m_cond.wait (lock, [this] {
return this->m_count == 0; });
#endif
}
void addref ()
{
std::lock_guard <decltype(m_mutex)> lock (m_mutex);
++m_count;
}
void release ()
{
std::lock_guard <decltype(m_mutex)> lock (m_mutex);
if (--m_count == 0)
m_cond.notify_all ();
}
template <class Handler>
struct sample_op
{
Handler m_handler;
time_point m_start;
bool m_repeat;
io_latency_probe* m_probe;
sample_op (Handler const& handler, time_point const& start,
bool repeat, io_latency_probe* probe)
: m_handler (handler)
, m_start (start)
, m_repeat (repeat)
, m_probe (probe)
{
m_probe->addref();
}
sample_op (sample_op const& other)
: m_handler (other.m_handler)
, m_start (other.m_start)
, m_probe (other.m_probe)
{
m_probe->addref();
}
~sample_op ()
{
m_probe->release();
}
void operator() () const
{
typename Clock::time_point const now (Clock::now());
typename Clock::duration const elapsed (now - m_start);
m_handler (elapsed);
{
std::lock_guard <decltype (m_probe->m_mutex)
> lock (m_probe->m_mutex);
if (m_probe->m_cancel)
return;
}
if (m_repeat)
{
// Calculate when we want to sample again, and
// adjust for the expected latency.
//
typename Clock::time_point const when (
now + m_probe->m_period - 2 * elapsed);
if (when <= now)
{
// The latency is too high to maintain the desired
// period so don't bother with a timer.
//
m_probe->m_ios.post (sample_op <Handler> (
m_handler, now, m_repeat, m_probe));
}
else
{
boost::posix_time::microseconds mms (
std::chrono::duration_cast <
std::chrono::microseconds> (
when - now).count ());
m_probe->m_timer.expires_from_now (mms);
m_probe->m_timer.async_wait (sample_op <Handler> (
m_handler, now, m_repeat, m_probe));
}
}
}
void operator () (boost::system::error_code const& ec)
{
typename Clock::time_point const now (Clock::now());
m_probe->m_ios.post (sample_op <Handler> (
m_handler, now, m_repeat, m_probe));
}
};
};
}
#endif

View File

@@ -0,0 +1,41 @@
//------------------------------------------------------------------------------
/*
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_ASIO_PLACEHOLDERS_H_INCLUDED
#define BEAST_ASIO_PLACEHOLDERS_H_INCLUDED
#include <functional>
namespace beast {
namespace asio {
namespace placeholders {
// asio placeholders that work with std::bind
namespace {
static auto const error (std::placeholders::_1);
static auto const bytes_transferred (std::placeholders::_2);
static auto const iterator (std::placeholders::_2);
static auto const signal_number (std::placeholders::_2);
}
}
}
}
#endif

View File

@@ -0,0 +1,472 @@
//------------------------------------------------------------------------------
/*
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_ASIO_SHARED_HANDLER_H_INCLUDED
#define BEAST_ASIO_SHARED_HANDLER_H_INCLUDED
#include "../mpl/IsCallPossible.h"
#include <functional>
#include <memory>
#include "../cxx14/type_traits.h" // <type_traits>
#include <boost/utility/base_from_member.hpp>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
#include <boost/asio/detail/handler_cont_helpers.hpp>
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#ifndef BEAST_ASIO_NO_ALLOCATE_SHARED
#define BEAST_ASIO_NO_ALLOCATE_SHARED 0
#endif
#ifndef BEAST_ASIO_NO_HANDLER_RESULT_OF
#define BEAST_ASIO_NO_HANDLER_RESULT_OF 1
#endif
namespace beast {
namespace asio {
class shared_handler_wrapper_base
{
public:
virtual ~shared_handler_wrapper_base()
{
}
virtual void invoke (std::function <void (void)> f) = 0;
virtual void* allocate (std::size_t size) = 0;
virtual void deallocate (void* p, std::size_t size) = 0;
virtual bool is_continuation () = 0;
};
//------------------------------------------------------------------------------
template <class Signature>
class shared_handler_wrapper_func
: public shared_handler_wrapper_base
{
private:
std::function <Signature> m_func;
public:
template <class Handler>
explicit shared_handler_wrapper_func (Handler&& handler)
: m_func (std::ref (std::forward <Handler> (handler)))
{
}
template <class... Args>
#if BEAST_ASIO_NO_HANDLER_RESULT_OF
void
#else
std::result_of_t <std::function <Signature> (Args...)>
#endif
operator() (Args&&... args) const
{
return m_func (std::forward <Args> (args)...);
}
};
//------------------------------------------------------------------------------
namespace detail {
#ifdef _MSC_VER
#pragma warning (push)
#pragma warning (disable: 4512) // assignment operator could not be generated
#endif
template <class Signature, class Handler>
class shared_handler_wrapper
: private boost::base_from_member <Handler>
, public shared_handler_wrapper_func <Signature>
{
private:
typedef boost::base_from_member <Handler> Base;
BEAST_DEFINE_IS_CALL_POSSIBLE(has_is_continuation, is_continuation);
public:
shared_handler_wrapper (Handler&& handler)
: boost::base_from_member <Handler> (std::move (handler))
, shared_handler_wrapper_func <Signature> (Base::member)
{
}
shared_handler_wrapper (Handler const& handler)
: boost::base_from_member <Handler> (handler)
, shared_handler_wrapper_func <Signature> (Base::member)
{
}
private:
void
invoke (std::function <void (void)> f) override
{
return boost_asio_handler_invoke_helpers::
invoke (f, Base::member);
}
void*
allocate (std::size_t size) override
{
return boost_asio_handler_alloc_helpers::
allocate (size, Base::member);
}
void
deallocate (void* p, std::size_t size) override
{
boost_asio_handler_alloc_helpers::
deallocate (p, size, Base::member);
}
bool
is_continuation () override
{
return is_continuation (std::integral_constant <bool,
has_is_continuation <Handler, bool(void)>::value>());
}
bool
is_continuation (std::true_type)
{
return Base::member.is_continuation();
}
bool
is_continuation (std::false_type)
{
return boost_asio_handler_cont_helpers::
is_continuation (Base::member);
}
};
#ifdef _MSC_VER
#pragma warning (pop)
#endif
template <class T>
struct is_shared_handler : public std::false_type
{
};
//------------------------------------------------------------------------------
template <class T, class Handler>
class handler_allocator
{
private:
// We want a partial template specialization as a friend
// but that isn't allowed so we friend all versions. This
// should produce a compile error if Handler is not constructible
// from H.
//
template <class U, class H>
friend class handler_allocator;
Handler m_handler;
public:
typedef T value_type;
typedef T* pointer;
template <class U>
struct rebind
{
public:
typedef handler_allocator <U, Handler> other;
};
handler_allocator() = delete;
handler_allocator (Handler const& handler)
: m_handler (handler)
{
}
template <class U>
handler_allocator (
handler_allocator <U, Handler> const& other)
: m_handler (other.m_handler)
{
}
handler_allocator&
operator= (handler_allocator const&) = delete;
pointer
allocate (std::ptrdiff_t n)
{
auto const size (n * sizeof (T));
return static_cast <pointer> (
boost_asio_handler_alloc_helpers::allocate (
size, m_handler));
}
void
deallocate (pointer p, std::ptrdiff_t n)
{
auto const size (n * sizeof (T));
boost_asio_handler_alloc_helpers::deallocate (
p, size, m_handler);
}
// Work-around for MSVC not using allocator_traits
// in the implementation of shared_ptr
//
#ifdef _MSC_VER
void
destroy (T* t)
{
t->~T();
}
#endif
friend
bool
operator== (handler_allocator const& lhs, handler_allocator const& rhs)
{
return true;
}
friend
bool
operator!= (handler_allocator const& lhs, handler_allocator const& rhs)
{
return ! (lhs == rhs);
}
};
}
//------------------------------------------------------------------------------
/** Handler shared reference that provides io_service execution guarantees. */
template <
class Signature
>
class shared_handler
{
private:
template <class T>
friend class shared_handler_allocator;
typedef shared_handler_wrapper_func <
Signature> wrapper_type;
typedef std::shared_ptr <wrapper_type> ptr_type;
ptr_type m_ptr;
public:
shared_handler()
{
}
template <
class DeducedHandler,
class = std::enable_if_t <
! detail::is_shared_handler <
std::decay_t <DeducedHandler>>::value &&
std::is_constructible <std::function <Signature>,
std::decay_t <DeducedHandler>>::value
>
>
shared_handler (DeducedHandler&& handler)
{
typedef std::remove_reference_t <DeducedHandler> Handler;
#if BEAST_ASIO_NO_ALLOCATE_SHARED
m_ptr = std::make_shared <detail::shared_handler_wrapper <
Signature, Handler>> (std::forward <DeducedHandler> (handler));
#else
m_ptr = std::allocate_shared <detail::shared_handler_wrapper <
Signature, Handler>> (detail::handler_allocator <char, Handler> (
handler), std::forward <DeducedHandler> (handler));
#endif
}
shared_handler (shared_handler&& other)
: m_ptr (std::move (other.m_ptr))
{
}
shared_handler (shared_handler const& other)
: m_ptr (other.m_ptr)
{
}
shared_handler&
operator= (std::nullptr_t)
{
m_ptr = nullptr;
}
shared_handler&
operator= (shared_handler const& rhs)
{
m_ptr = rhs.m_ptr;
return *this;
}
bool
empty() const
{
return ! m_ptr.operator bool();
}
operator bool() const
{
return !empty();
}
void
reset()
{
m_ptr.reset();
}
template <class... Args>
#if BEAST_ASIO_NO_HANDLER_RESULT_OF
void
#else
std::result_of_t <std::function <Signature> (Args...)>
#endif
operator() (Args&&... args) const
{
return (*m_ptr)(std::forward <Args> (args)...);
}
template <class Function>
friend
void
asio_handler_invoke (Function&& f, shared_handler* h)
{
return h->m_ptr->invoke (f);
}
friend
void*
asio_handler_allocate (
std::size_t size, shared_handler* h)
{
return h->m_ptr->allocate (size);
}
friend
void
asio_handler_deallocate (
void* p, std::size_t size, shared_handler* h)
{
return h->m_ptr->deallocate (p, size);
}
friend
bool
asio_handler_is_continuation (
shared_handler* h)
{
return h->m_ptr->is_continuation ();
}
};
//------------------------------------------------------------------------------
namespace detail {
template <
class Signature
>
struct is_shared_handler <
shared_handler <Signature>
> : public std::true_type
{
};
}
//------------------------------------------------------------------------------
template <class T>
class shared_handler_allocator
{
private:
template <class U>
friend class shared_handler_allocator;
std::shared_ptr <shared_handler_wrapper_base> m_ptr;
public:
typedef T value_type;
typedef T* pointer;
shared_handler_allocator() = delete;
template <class Signature>
shared_handler_allocator (
shared_handler <Signature> const& handler)
: m_ptr (handler.m_ptr)
{
}
template <class U>
shared_handler_allocator (
shared_handler_allocator <U> const& other)
: m_ptr (other.m_ptr)
{
}
pointer
allocate (std::ptrdiff_t n)
{
auto const size (n * sizeof (T));
return static_cast <pointer> (
m_ptr->allocate (size));
}
void
deallocate (pointer p, std::ptrdiff_t n)
{
auto const size (n * sizeof (T));
m_ptr->deallocate (p, size);
}
friend
bool
operator== (shared_handler_allocator const& lhs,
shared_handler_allocator const& rhs)
{
return lhs.m_ptr == rhs.m_ptr;
}
friend
bool
operator!= (shared_handler_allocator const& lhs,
shared_handler_allocator const& rhs)
{
return ! (lhs == rhs);
}
};
}
}
#endif

View File

@@ -0,0 +1,58 @@
//------------------------------------------------------------------------------
/*
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 "BeastConfig.h"
#include "../../../modules/beast_core/beast_core.h" // for UnitTest
#include "../bind_handler.h"
#include <functional>
namespace beast {
namespace asio {
class bind_handler_Tests : public UnitTest
{
public:
static void foo (int)
{
}
void runTest()
{
beginTestCase ("call");
auto f (bind_handler (std::bind (&foo, std::placeholders::_1),
42));
f();
pass();
}
bind_handler_Tests() : UnitTest ("bind_handler", "beast", runManual)
{
}
};
static bind_handler_Tests bind_handler_tests;
}
}

View File

@@ -0,0 +1,239 @@
//------------------------------------------------------------------------------
/*
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 "BeastConfig.h"
#include "../../../modules/beast_core/beast_core.h" // for UnitTest
#include "../shared_handler.h"
// Disables is_constructible tests for std::function
// Visual Studio std::function fails the is_constructible tests
#ifndef BEAST_NO_STD_FUNCTION_CONSTRUCTIBLE
# ifdef _MSC_VER
# define BEAST_NO_STD_FUNCTION_CONSTRUCTIBLE 1
# else
# define BEAST_NO_STD_FUNCTION_CONSTRUCTIBLE 0
# endif
#endif
namespace beast {
class shared_handler_Tests : public UnitTest
{
public:
struct test_results
{
bool call;
bool invoke;
bool alloc;
bool dealloc;
bool cont;
test_results ()
: call (false)
, invoke (false)
, alloc (false)
, dealloc (false)
, cont (false)
{
}
};
struct test_handler
{
std::reference_wrapper <test_results> results;
explicit test_handler (test_results& results_)
: results (results_)
{
}
void operator() ()
{
results.get().call = true;
}
template <class Function>
friend void asio_handler_invoke (
Function& f, test_handler* h)
{
h->results.get().invoke = true;
f();
}
template <class Function>
friend void asio_handler_invoke (
Function const& f, test_handler* h)
{
h->results.get().invoke = true;
f();
}
friend void* asio_handler_allocate (
std::size_t size, test_handler* h)
{
h->results.get().alloc = true;
return boost::asio::asio_handler_allocate (size);
}
friend void asio_handler_deallocate (
void* p, std::size_t size, test_handler* h)
{
h->results.get().dealloc = true;
boost::asio::asio_handler_deallocate (p, size);
}
friend bool asio_handler_is_continuation (
test_handler* h)
{
h->results.get().cont = true;
return true;
}
};
struct test_invokable
{
bool call;
test_invokable ()
: call (false)
{
}
void operator() ()
{
call = true;
}
};
template <class Handler>
bool async_op (Handler&& handler)
{
void* const p (boost_asio_handler_alloc_helpers::allocate (32, handler));
handler();
boost_asio_handler_alloc_helpers::deallocate (p, 32, handler);
return boost_asio_handler_cont_helpers::is_continuation (handler);
}
void virtual_async_op (asio::shared_handler <void(void)> handler)
{
async_op (handler);
}
void runTest()
{
beginTestCase ("hooks");
#if ! BEAST_NO_STD_FUNCTION_CONSTRUCTIBLE
static_assert (! std::is_constructible <
std::function <void(void)>, int&&>::value,
"Cannot construct std::function from int&&");
static_assert (! std::is_constructible <
std::function <void(void)>, int>::value,
"Cannot construct std::function from int");
static_assert (! std::is_constructible <
asio::shared_handler <void(void)>, int>::value,
"Cannot construct shared_handler from int");
#endif
static_assert (std::is_constructible <
asio::shared_handler <void(int)>,
asio::shared_handler <void(int)>>::value,
"Should construct <void(int)> from <void(int)>");
static_assert (! std::is_constructible <
asio::shared_handler <void(int)>,
asio::shared_handler <void(void)>>::value,
"Can't construct <void(int)> from <void(void)>");
// Hooks called when using the raw handler
{
test_results r;
test_handler h (r);
async_op (h);
expect (r.call);
expect (r.alloc);
expect (r.dealloc);
expect (r.cont);
test_invokable f;
boost_asio_handler_invoke_helpers::invoke (std::ref (f), h);
expect (r.invoke);
expect (f.call);
}
// Use of std::function shows the hooks not getting called
{
test_results r;
std::function <void(void)> fh ((test_handler) (r));
async_op (fh);
expect (r.call);
unexpected (r.alloc);
unexpected (r.dealloc);
unexpected (r.cont);
test_invokable f;
boost_asio_handler_invoke_helpers::invoke (std::ref (f), fh);
unexpected (r.invoke);
expect (f.call);
}
// Make sure shared_handler calls the hooks
{
test_results r;
asio::shared_handler <void(void)> sh ((test_handler)(r));
async_op (sh);
expect (r.call);
expect (r.alloc);
expect (r.dealloc);
expect (r.cont);
test_invokable f;
boost_asio_handler_invoke_helpers::invoke (std::ref (f), sh);
expect (r.invoke);
expect (f.call);
}
// Make sure shared_handler via implicit conversion calls hooks
{
test_results r;
test_handler h (r);
virtual_async_op ((test_handler) (r));
expect (r.call);
expect (r.alloc);
expect (r.dealloc);
expect (r.cont);
}
}
shared_handler_Tests() : UnitTest ("shared_handler", "beast")
{
}
};
static shared_handler_Tests shared_handler_tests;
}

View File

@@ -0,0 +1,287 @@
//------------------------------------------------------------------------------
/*
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 "BeastConfig.h"
#include "../../../modules/beast_core/beast_core.h" // for UnitTest
#include "../wrap_handler.h"
#include <boost/version.hpp>
#include <boost/bind.hpp>
#include <functional>
#include <memory>
namespace beast {
namespace asio {
//------------------------------------------------------------------------------
// Displays the order of destruction of parameters in the bind wrapper
//
class boost_bind_Tests : public UnitTest
{
public:
struct Result
{
std::string text;
void push_back (std::string const& s)
{
if (! text.empty())
text += ", ";
text += s;
}
};
struct Payload
{
std::reference_wrapper <Result> m_result;
std::string m_name;
explicit Payload (Result& result, std::string const& name)
: m_result (result)
, m_name (name)
{
}
~Payload ()
{
m_result.get().push_back (m_name);
}
};
struct Arg
{
std::shared_ptr <Payload> m_payload;
Arg (Result& result, std::string const& name)
: m_payload (std::make_shared <Payload> (result, name))
{
}
};
static void foo (Arg const&, Arg const&, Arg const&)
{
}
void runTest()
{
beginTestCase ("order");
{
Result r;
{
boost::bind (&foo,
Arg (r, "one"),
Arg (r, "two"),
Arg (r, "three"));
}
logMessage (std::string ("boost::bind (") + r.text + ")");
}
{
Result r;
{
std::bind (&foo,
Arg (r, "one"),
Arg (r, "two"),
Arg (r, "three"));
}
logMessage (std::string ("std::bind (") + r.text + ")");
}
pass();
}
boost_bind_Tests() : UnitTest ("bind", "beast", runManual)
{
}
};
static boost_bind_Tests boost_bind_tests;
//------------------------------------------------------------------------------
class wrap_handler_handler_Tests : public UnitTest
{
public:
struct test_results
{
bool call;
bool invoke;
bool alloc;
bool dealloc;
bool cont;
test_results ()
: call (false)
, invoke (false)
, alloc (false)
, dealloc (false)
, cont (false)
{
}
};
struct test_handler
{
std::reference_wrapper <test_results> results;
explicit test_handler (test_results& results_)
: results (results_)
{
}
void operator() ()
{
results.get().call = true;
}
template <class Function>
friend void asio_handler_invoke (
Function& f, test_handler* h)
{
h->results.get().invoke = true;
f();
}
template <class Function>
friend void asio_handler_invoke (
Function const& f, test_handler* h)
{
h->results.get().invoke = true;
f();
}
friend void* asio_handler_allocate (
std::size_t, test_handler* h)
{
h->results.get().alloc = true;
return nullptr;
}
friend void asio_handler_deallocate (
void*, std::size_t, test_handler* h)
{
h->results.get().dealloc = true;
}
friend bool asio_handler_is_continuation (
test_handler* h)
{
h->results.get().cont = true;
return true;
}
};
struct test_invokable
{
bool call;
test_invokable ()
: call (false)
{
}
void operator() ()
{
call = true;
}
};
template <class Handler>
bool async_op (Handler&& handler)
{
void* const p (boost_asio_handler_alloc_helpers::allocate (32, handler));
(handler)();
boost_asio_handler_alloc_helpers::deallocate (p, 32, handler);
return boost_asio_handler_cont_helpers::is_continuation (handler);
}
void runTest()
{
beginTestCase ("hooks");
// Hooks called when using the raw handler
{
test_results r;
test_handler h (r);
async_op (h);
expect (r.call);
expect (r.alloc);
expect (r.dealloc);
expect (r.cont);
test_invokable f;
boost_asio_handler_invoke_helpers::invoke (std::ref (f), h);
expect (r.invoke);
expect (f.call);
}
// Use of boost::bind shows the hooks not getting called
{
test_results r;
test_handler h (r);
auto b (std::bind (&test_handler::operator(), &h));
async_op (b);
expect (r.call);
unexpected (r.alloc);
unexpected (r.dealloc);
unexpected (r.cont);
test_invokable f;
boost_asio_handler_invoke_helpers::invoke (std::ref (f), b);
unexpected (r.invoke);
expect (f.call);
}
// Make sure the wrapped handler calls the hooks
{
test_results r;
test_handler h (r);
auto w (wrap_handler (
std::bind (&test_handler::operator(), test_handler(r)), h));
async_op (w);
expect (r.call);
expect (r.alloc);
expect (r.dealloc);
expect (r.cont);
test_invokable f;
boost_asio_handler_invoke_helpers::invoke (std::ref (f), w);
expect (r.invoke);
expect (f.call);
}
}
wrap_handler_handler_Tests() : UnitTest ("wrap_handler", "beast")
{
}
};
static wrap_handler_handler_Tests wrap_handler_handler_tests;
}
}

View File

@@ -0,0 +1,176 @@
//------------------------------------------------------------------------------
/*
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_ASIO_WRAP_HANDLER_H_INCLUDED
#define BEAST_ASIO_WRAP_HANDLER_H_INCLUDED
#include <boost/asio/detail/handler_alloc_helpers.hpp>
#include <boost/asio/detail/handler_cont_helpers.hpp>
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#include <type_traits>
#include <utility>
namespace beast {
namespace asio {
#ifdef _MSC_VER
#pragma warning (push)
#pragma warning (disable: 4512) // assignment operator could not be generated
#endif
namespace detail {
/** A handler which wraps another handler using a specfic context.
The handler is invoked with the same io_service execution guarantees
as the provided context.
@note A copy of Context is made.
*/
template <class Handler, class Context>
class wrapped_handler
{
private:
Handler m_handler;
Context m_context;
bool m_continuation;
// If this goes off, consider carefully what the intent is.
static_assert (! std::is_reference <Handler>::value,
"Handler should not be a reference type");
public:
wrapped_handler (bool continuation, Handler&& handler, Context context)
: m_handler (std::move (handler))
, m_context (context)
, m_continuation (continuation ? true :
boost_asio_handler_cont_helpers::is_continuation (context))
{
}
wrapped_handler (bool continuation, Handler const& handler, Context context)
: m_handler (handler)
, m_context (context)
, m_continuation (continuation ? true :
boost_asio_handler_cont_helpers::is_continuation (context))
{
}
template <class... Args>
void
operator() (Args&&... args)
{
m_handler (std::forward <Args> (args)...);
}
template <class... Args>
void
operator() (Args&&... args) const
{
m_handler (std::forward <Args> (args)...);
}
template <class Function>
friend
void
asio_handler_invoke (Function& f, wrapped_handler* h)
{
boost_asio_handler_invoke_helpers::
invoke (f, h->m_context);
}
template <class Function>
friend
void
asio_handler_invoke (Function const& f, wrapped_handler* h)
{
boost_asio_handler_invoke_helpers::
invoke (f, h->m_context);
}
friend
void*
asio_handler_allocate (std::size_t size, wrapped_handler* h)
{
return boost_asio_handler_alloc_helpers::
allocate (size, h->m_context);
}
friend
void
asio_handler_deallocate (void* p, std::size_t size, wrapped_handler* h)
{
boost_asio_handler_alloc_helpers::
deallocate (p, size, h->m_context);
}
friend
bool
asio_handler_is_continuation (wrapped_handler* h)
{
return h->m_continuation;
}
};
}
//------------------------------------------------------------------------------
// Tag for dispatching wrap_handler with is_continuation == true
enum continuation_t
{
continuation
};
/** Returns a wrapped handler so it executes within another context.
The handler is invoked with the same io_service execution guarantees
as the provided context. The handler will be copied if necessary.
@note A copy of Context is made.
*/
/** @{ */
template <class DeducedHandler, class Context>
detail::wrapped_handler <
std::remove_reference_t <DeducedHandler>,
Context
>
wrap_handler (DeducedHandler&& handler, Context const& context,
bool continuation = false)
{
typedef std::remove_reference_t <DeducedHandler> Handler;
return detail::wrapped_handler <Handler, Context> (continuation,
std::forward <DeducedHandler> (handler), context);
}
template <class DeducedHandler, class Context>
detail::wrapped_handler <
std::remove_reference_t <DeducedHandler>,
Context
>
wrap_handler (continuation_t, DeducedHandler&& handler,
Context const& context)
{
typedef std::remove_reference_t <DeducedHandler> Handler;
return detail::wrapped_handler <Handler, Context> (true,
std::forward <DeducedHandler> (handler), context);
}
/** @} */
}
}
#endif

View File

@@ -19,12 +19,12 @@
#include "BeastConfig.h"
#include "beast_crypto.h"
#include "ErrorCode.h"
namespace beast
{
namespace detail {
#include "math/BinaryEncoding.cpp"
#include "math/UnsignedInteger.cpp"
// to squelch linker warnings
int boostUnusedVariable = 0;
}

View File

@@ -17,30 +17,19 @@
*/
//==============================================================================
#ifndef BEAST_MPL_REMOVECONST_H_INCLUDED
#define BEAST_MPL_REMOVECONST_H_INCLUDED
#ifndef BEAST_BOOST_ERRORCODE_H_INCLUDED
#define BEAST_BOOST_ERRORCODE_H_INCLUDED
// Ideas based on boost
#include <boost/system/error_code.hpp>
namespace beast {
namespace mpl {
/** Remove the `const` qualifier from a type. */
/** @{ */
template <typename T>
struct RemoveConst
{
typedef T type;
};
// Lift this into our namespace. For now we will
// use boost, and then switch to std::error_code when
// it is available on all our supported platforms.
//
typedef boost::system::error_code ErrorCode;
template <typename T>
struct RemoveConst <T const>
{
typedef T type;
};
/** @} */
}
}
#endif

View File

@@ -0,0 +1,46 @@
//------------------------------------------------------------------------------
/*
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_BOOST_GET_POINTER_H_INCLUDED
#define BEAST_BOOST_GET_POINTER_H_INCLUDED
#include <boost/get_pointer.hpp>
// Boost 1.55 incorrectly defines BOOST_NO_CXX11_SMART_PTR
// when building with clang 3.4 and earlier. This workaround
// gives beast its own overloads.
#ifdef BOOST_NO_CXX11_SMART_PTR
#include <memory>
namespace beast {
template <class T>
T* get_pointer (std::unique_ptr<T> const& p)
{
return p.get();
}
template <class T>
T* get_pointer (std::shared_ptr<T> const& p)
{
return p.get();
}
}
#endif
#endif

View File

@@ -0,0 +1,159 @@
//------------------------------------------------------------------------------
/*
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_CHRONO_CPUMETER_H_INCLUDED
#define BEAST_CHRONO_CPUMETER_H_INCLUDED
#include "RelativeTime.h"
#include "ScopedTimeInterval.h"
#include "../threads/SharedData.h"
#include "../Atomic.h"
namespace beast {
/** Measurements of CPU utilization. */
class CPUMeter
{
private:
struct MeasureIdle
{
explicit MeasureIdle (CPUMeter& meter)
: m_meter (&meter)
{ }
void operator() (RelativeTime const& interval) const
{ m_meter->addIdleTime (interval); }
CPUMeter* m_meter;
};
struct MeasureActive
{
explicit MeasureActive (CPUMeter& meter)
: m_meter (&meter)
{ }
void operator() (RelativeTime const& interval) const
{ m_meter->addActiveTime (interval); }
CPUMeter* m_meter;
};
enum
{
// The amount of time an aggregate must accrue before a swap
secondsPerAggregate = 3
// The number of aggregates in the rolling history buffer
,numberOfAggregates = 20
};
// Aggregated sample data
struct Aggregate
{
RelativeTime idle;
RelativeTime active;
// Returns the total number of seconds in the aggregate
double seconds () const
{ return idle.inSeconds() + active.inSeconds(); }
// Reset the accumulated times
void clear ()
{ idle = RelativeTime (0); active = RelativeTime (0); }
Aggregate& operator+= (Aggregate const& other)
{ idle += other.idle; active += other.active; return *this; }
Aggregate& operator-= (Aggregate const& other)
{ idle -= other.idle; active -= other.active; return *this; }
};
struct State
{
State () : index (0)
{
}
// Returns a reference to the current aggregate
Aggregate& front ()
{
return history [index];
}
// Checks the current aggregate to see if we should advance
void update()
{
if (front().seconds() >= secondsPerAggregate)
advance();
}
// Advance the index in the rolling history
void advance ()
{
usage += history [index];
index = (index+1) % numberOfAggregates;
usage -= history [index];
history [index].clear ();
}
// Index of the current aggregate we are accumulating
int index;
// Delta summed usage over the entire history buffer
Aggregate usage;
// The rolling history buffer
Aggregate history [numberOfAggregates];
};
typedef SharedData <State> SharedState;
SharedState m_state;
void addIdleTime (RelativeTime const& interval)
{
SharedState::Access state (m_state);
state->front().idle += interval;
state->update();
}
void addActiveTime (RelativeTime const& interval)
{
SharedState::Access state (m_state);
state->front().active += interval;
state->update();
}
public:
/** The type of container that measures idle time. */
typedef ScopedTimeInterval <MeasureIdle> ScopedIdleTime;
typedef ScopedTimeInterval <MeasureActive> ScopedActiveTime;
/** Returns the fraction of time that the CPU is being used. */
double getUtilization () const
{
SharedState::ConstAccess state (m_state);
double const seconds (state->usage.seconds());
if (seconds > 0)
return (state->usage.active.inSeconds() / seconds);
return 0;
}
};
}
#endif

View File

@@ -19,4 +19,12 @@
#include "BeastConfig.h"
#include "../Config.h"
#include "../../modules/beast_core/beast_core.h" // for UnitTest
#include "impl/abstract_clock.cpp"
#include "impl/chrono_io.cpp"
#include "impl/basic_seconds_clock.cpp"
#include "impl/CPUMeter.cpp"
#include "impl/RelativeTime.cpp"

View File

@@ -43,13 +43,22 @@ namespace beast {
class BEAST_API RelativeTime
{
public:
//==============================================================================
/** The underlying data type used by RelativeTime.
If you need to get to the underlying time and manipulate it
you can use this to declare a type that is guaranteed to
work cleanly.
*/
typedef double value_type;
//==============================================================================
/** Creates a RelativeTime.
@param seconds the number of seconds, which may be +ve or -ve.
@see milliseconds, minutes, hours, days, weeks
*/
explicit RelativeTime (double seconds = 0.0) noexcept;
explicit RelativeTime (value_type seconds = 0.0) noexcept;
/** Copies another relative time. */
RelativeTime (const RelativeTime& other) noexcept;
@@ -60,6 +69,12 @@ public:
/** Destructor. */
~RelativeTime() noexcept;
bool isZero() const
{ return numSeconds == 0; }
bool isNotZero() const
{ return numSeconds != 0; }
/** Returns the amount of time since the process was started. */
static RelativeTime fromStartup ();
@@ -77,27 +92,27 @@ public:
/** Creates a new RelativeTime object representing a number of seconds.
@see milliseconds, minutes, hours, days, weeks
*/
static RelativeTime seconds (double seconds) noexcept;
static RelativeTime seconds (value_type seconds) noexcept;
/** Creates a new RelativeTime object representing a number of minutes.
@see milliseconds, hours, days, weeks
*/
static RelativeTime minutes (double numberOfMinutes) noexcept;
static RelativeTime minutes (value_type numberOfMinutes) noexcept;
/** Creates a new RelativeTime object representing a number of hours.
@see milliseconds, minutes, days, weeks
*/
static RelativeTime hours (double numberOfHours) noexcept;
static RelativeTime hours (value_type numberOfHours) noexcept;
/** Creates a new RelativeTime object representing a number of days.
@see milliseconds, minutes, hours, weeks
*/
static RelativeTime days (double numberOfDays) noexcept;
static RelativeTime days (value_type numberOfDays) noexcept;
/** Creates a new RelativeTime object representing a number of weeks.
@see milliseconds, minutes, hours, days
*/
static RelativeTime weeks (double numberOfWeeks) noexcept;
static RelativeTime weeks (value_type numberOfWeeks) noexcept;
//==============================================================================
/** Returns the number of milliseconds this time represents.
@@ -108,27 +123,27 @@ public:
/** Returns the number of seconds this time represents.
@see inMilliseconds, inMinutes, inHours, inDays, inWeeks
*/
double inSeconds() const noexcept { return numSeconds; }
value_type inSeconds() const noexcept { return numSeconds; }
/** Returns the number of minutes this time represents.
@see inMilliseconds, inSeconds, inHours, inDays, inWeeks
*/
double inMinutes() const noexcept;
value_type inMinutes() const noexcept;
/** Returns the number of hours this time represents.
@see inMilliseconds, inSeconds, inMinutes, inDays, inWeeks
*/
double inHours() const noexcept;
value_type inHours() const noexcept;
/** Returns the number of days this time represents.
@see inMilliseconds, inSeconds, inMinutes, inHours, inWeeks
*/
double inDays() const noexcept;
value_type inDays() const noexcept;
/** Returns the number of weeks this time represents.
@see inMilliseconds, inSeconds, inMinutes, inHours, inDays
*/
double inWeeks() const noexcept;
value_type inWeeks() const noexcept;
/** Returns a readable textual description of the time.
@@ -148,10 +163,12 @@ public:
String getDescription (const String& returnValueForZeroTime = "0") const;
std::string to_string () const;
RelativeTime operator+ (double seconds) const noexcept
template <typename Number>
RelativeTime operator+ (Number seconds) const noexcept
{ return RelativeTime (numSeconds + seconds); }
RelativeTime operator- (double seconds) const noexcept
template <typename Number>
RelativeTime operator- (Number seconds) const noexcept
{ return RelativeTime (numSeconds - seconds); }
/** Adds another RelativeTime to this one. */
@@ -161,13 +178,13 @@ public:
RelativeTime operator-= (RelativeTime timeToSubtract) noexcept;
/** Adds a number of seconds to this time. */
RelativeTime operator+= (double secondsToAdd) noexcept;
RelativeTime operator+= (value_type secondsToAdd) noexcept;
/** Subtracts a number of seconds from this time. */
RelativeTime operator-= (double secondsToSubtract) noexcept;
RelativeTime operator-= (value_type secondsToSubtract) noexcept;
private:
double numSeconds;
value_type numSeconds;
};
//------------------------------------------------------------------------------

View File

@@ -17,47 +17,46 @@
*/
//==============================================================================
#ifndef BEAST_GLOBALFIFOFREESTORE_H_INCLUDED
#define BEAST_GLOBALFIFOFREESTORE_H_INCLUDED
#ifndef BEAST_CHRONO_SCOPEDTIMEINTERVAL_H_INCLUDED
#define BEAST_CHRONO_SCOPEDTIMEINTERVAL_H_INCLUDED
/*============================================================================*/
/**
A @ref FifoFreeStoreType singleton.
#include "../Uncopyable.h"
#include "RelativeTime.h"
@ingroup beast_concurrent
namespace beast {
/** Time measurement using scoped RAII container.
UnaryFunction will be called with this signature:
void (RelativeTime const& interval);
*/
template <class Tag>
class GlobalFifoFreeStore
template <class UnaryFunction>
class ScopedTimeInterval : public Uncopyable
{
public:
inline void* allocate (size_t bytes)
{
return m_allocator.allocate (bytes);
}
static inline void deallocate (void* const p)
{
FifoFreeStoreType::deallocate (p);
}
typedef SharedPtr <SharedSingleton <GlobalFifoFreeStore> > Ptr;
static Ptr getInstance ()
{
return SharedSingleton <GlobalFifoFreeStore>::getInstance();
}
public:
GlobalFifoFreeStore ()
/** Create the measurement with a default-constructed UnaryFunction. */
ScopedTimeInterval ()
: m_start (RelativeTime::fromStartup())
{
}
~GlobalFifoFreeStore ()
/** Create the measurement with UnaryFunction constructed from one argument. */
template <typename Arg>
explicit ScopedTimeInterval (Arg& arg)
: m_func (arg)
, m_start (RelativeTime::fromStartup ())
{
}
~ScopedTimeInterval ()
{
m_func (RelativeTime::fromStartup() - m_start);
}
private:
FifoFreeStoreType m_allocator;
UnaryFunction m_func;
RelativeTime m_start;
};
}
#endif

View File

@@ -0,0 +1,166 @@
//------------------------------------------------------------------------------
/*
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_CHRONO_ABSTRACT_CLOCK_H_INCLUDED
#define BEAST_CHRONO_ABSTRACT_CLOCK_H_INCLUDED
#include <chrono>
#include "chrono_io.h"
namespace beast {
/** Abstract interface to a clock.
The abstract clock interface allows a dependency injection to take
place so that the choice of implementation can be made at run-time
instead of compile time. The trade-off is that the Duration used to
represent the clock must be chosen at compile time and cannot be
changed. This includes both the choice of representation (integers
for example) and the period in ticks corresponding to one second.
Example:
@code
struct Implementation
{
abstract_clock <std::chrono::seconds>& m_clock;
// Dependency injection
//
explicit Implementation (
abstract_clock <std::chrono::seconds>& clock)
: m_clock (clock)
{
}
};
@endcode
@tparam The length of time, in seconds, corresponding to one tick.
*/
template <class Duration>
class abstract_clock
{
public:
typedef typename Duration::rep rep;
typedef typename Duration::period period;
typedef Duration duration;
typedef std::chrono::time_point <
abstract_clock, duration> time_point;
virtual ~abstract_clock () { }
/** Returns `true` if this is a steady clock. */
virtual bool is_steady () const = 0;
/** Returns the current time. */
virtual time_point now () const = 0;
/** Convert the specified time point to a string. */
/** @{ */
virtual std::string to_string (time_point const& tp) const = 0;
template <class Duration2>
std::string to_string (
std::chrono::time_point <abstract_clock, Duration2> const& tp) const
{
return to_string (
std::chrono::time_point_cast <Duration> (tp));
}
/** @} */
/** Returning elapsed ticks since the epoch. */
rep elapsed () const
{
return now().time_since_epoch().count();
}
};
//------------------------------------------------------------------------------
namespace detail {
template <class TrivialClock, class Duration>
struct basic_abstract_clock_wrapper : public abstract_clock <Duration>
{
using typename abstract_clock <Duration>::duration;
using typename abstract_clock <Duration>::time_point;
bool is_steady () const
{
return TrivialClock::is_steady;
}
time_point now () const
{
return time_point (duration (
std::chrono::duration_cast <duration> (
TrivialClock::now().time_since_epoch ()).count ()));
}
};
template <class TrivialClock, class Duration>
struct abstract_clock_wrapper
: public basic_abstract_clock_wrapper <TrivialClock, Duration>
{
// generic conversion displays the duration
std::string to_string (typename basic_abstract_clock_wrapper <
TrivialClock, Duration>::time_point const& tp) const
{
std::stringstream ss;
ss << tp.time_since_epoch();
return ss.str ();
}
};
/*
template <class Duration>
struct abstract_clock_wrapper <std::chrono::system_clock, Duration>
: public basic_abstract_clock_wrapper <std::chrono::system_clock, Duration>
{
typedef std::chrono::system_clock clock_type;
std::string to_string (time_point const& tp)
{
std::stringstream ss;
ss << clock_type::time_point (tp.time_since_epoch ());
return ss.str ();
}
};
*/
}
//------------------------------------------------------------------------------
/** Retrieve a discrete clock for a type implementing the Clock concept.
The interface is created as an object with static storage duration.
*/
template <class TrivialClock, class Duration>
abstract_clock <Duration>& get_abstract_clock ()
{
static detail::abstract_clock_wrapper <
TrivialClock, Duration> clock;
return clock;
}
}
#endif

View File

@@ -0,0 +1,237 @@
//------------------------------------------------------------------------------
/*
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_CHRONO_BASIC_SECONDS_CLOCK_H_INCLUDED
#define BEAST_CHRONO_BASIC_SECONDS_CLOCK_H_INCLUDED
#include <algorithm>
#include <chrono>
#ifndef BEAST_BASIC_SECONDS_CLOCK_BOOST_WORKAROUND
# ifdef _MSC_VER
// Visual Studio 2012, 2013 have a bug in std::thread that
// causes a hang on exit, in the library function atexit()
# if BEAST_USE_BOOST_FEATURES
# define BEAST_BASIC_SECONDS_CLOCK_BOOST_WORKAROUND 1
# else
# define BEAST_BASIC_SECONDS_CLOCK_BOOST_WORKAROUND 0
# endif
# else
# define BEAST_BASIC_SECONDS_CLOCK_BOOST_WORKAROUND 0
# endif
#endif
#if BEAST_BASIC_SECONDS_CLOCK_BOOST_WORKAROUND
# include <boost/version.hpp>
# if BOOST_VERSION >= 105500
# include <boost/thread/thread.hpp>
# include <boost/thread/mutex.hpp>
# include <boost/thread/condition_variable.hpp>
# include <boost/chrono.hpp>
# else
# error "Boost version 1.55.0 or later is required"
# endif
#else
# include <condition_variable>
# include <mutex>
# include <thread>
#endif
#include "../chrono/chrono_util.h"
namespace beast {
namespace detail {
class seconds_clock_worker
{
public:
virtual void sample () = 0;
};
//------------------------------------------------------------------------------
// Updates the clocks
class seconds_clock_thread
{
public:
#if BEAST_BASIC_SECONDS_CLOCK_BOOST_WORKAROUND
typedef boost::mutex mutex;
typedef boost::condition_variable cond_var;
typedef boost::lock_guard <mutex> lock_guard;
typedef boost::unique_lock <mutex> unique_lock;
typedef boost::chrono::steady_clock clock_type;
typedef boost::chrono::seconds seconds;
typedef boost::thread thread;
#else
typedef std::mutex mutex;
typedef std::condition_variable cond_var;
typedef std::lock_guard <mutex> lock_guard;
typedef std::unique_lock <mutex> unique_lock;
typedef std::chrono::steady_clock clock_type;
typedef std::chrono::seconds seconds;
typedef std::thread thread;
#endif
typedef std::vector <seconds_clock_worker*> workers;
bool m_stop;
mutex m_mutex;
cond_var m_cond;
workers m_workers;
thread m_thread;
seconds_clock_thread ()
: m_stop (false)
{
m_thread = thread (std::bind(
&seconds_clock_thread::run, this));
}
~seconds_clock_thread ()
{
{
lock_guard lock (m_mutex);
m_stop = true;
}
m_cond.notify_all();
m_thread.join ();
}
void add (seconds_clock_worker& w)
{
lock_guard lock (m_mutex);
m_workers.push_back (&w);
}
void remove (seconds_clock_worker& w)
{
lock_guard lock (m_mutex);
m_workers.erase (std::find (
m_workers.begin (), m_workers.end(), &w));
}
void run ()
{
unique_lock lock (m_mutex);;
for (;;)
{
for (auto iter : m_workers)
iter->sample();
clock_type::time_point const when (
floor <seconds> (
clock_type::now().time_since_epoch()) +
seconds (1));
if (m_cond.wait_until (lock, when, [this]{ return m_stop; }))
return;
}
}
static seconds_clock_thread& instance ()
{
static seconds_clock_thread singleton;
return singleton;
}
};
}
//------------------------------------------------------------------------------
/** A clock whose minimum resolution is one second.
The purpose of this class is to optimize the performance of the now()
member function call. It uses a dedicated thread that wakes up at least
once per second to sample the requested trivial clock.
@tparam TrivialClock The clock to sample.
*/
template <class TrivialClock>
class basic_seconds_clock
{
public:
typedef std::chrono::seconds resolution;
typedef typename resolution::rep rep;
typedef typename resolution::period period;
typedef std::chrono::duration <rep, period> duration;
typedef std::chrono::time_point <basic_seconds_clock> time_point;
static bool const is_steady = TrivialClock::is_steady;
static time_point now ()
{
// Make sure the thread is constructed before the
// worker otherwise we will crash during destruction
// of objects with static storage duration.
struct initializer
{
initializer ()
{
detail::seconds_clock_thread::instance();
}
};
static initializer init;
struct worker : detail::seconds_clock_worker
{
typedef std::mutex mutex;
typedef std::lock_guard <mutex> lock_guard;
time_point m_now;
mutex m_mutex;
static time_point get_now ()
{
return time_point (floor <resolution> (
TrivialClock::now().time_since_epoch()));
}
worker ()
: m_now (get_now ())
{
detail::seconds_clock_thread::instance().add (*this);
}
~worker ()
{
detail::seconds_clock_thread::instance().remove (*this);
}
time_point now()
{
lock_guard lock (m_mutex);
return m_now;
}
void sample ()
{
lock_guard lock (m_mutex);
m_now = get_now ();
}
};
static worker w;
return w.now ();
}
};
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,66 @@
//------------------------------------------------------------------------------
/*
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_CHRONO_UTIL_H_INCLUDED
#define BEAST_CHRONO_UTIL_H_INCLUDED
// From Howard Hinnant
// http://home.roadrunner.com/~hinnant/duration_io/chrono_util.html
// round down
template <class To, class Rep, class Period>
To floor(std::chrono::duration <Rep, Period> const& d)
{
To t = std::chrono::duration_cast<To>(d);
if (t > d)
--t;
return t;
}
// round to nearest, to even on tie
template <class To, class Rep, class Period>
To round (std::chrono::duration <Rep, Period> const& d)
{
To t0 = std::chrono::duration_cast<To>(d);
To t1 = t0;
++t1;
auto diff0 = d - t0;
auto diff1 = t1 - d;
if (diff0 == diff1)
{
if (t0.count() & 1)
return t1;
return t0;
}
else if (diff0 < diff1)
return t0;
return t1;
}
// round up
template <class To, class Rep, class Period>
To ceil (std::chrono::duration <Rep, Period> const& d)
{
To t = std::chrono::duration_cast<To>(d);
if (t < d)
++t;
return t;
}
#endif

View File

@@ -0,0 +1,21 @@
//------------------------------------------------------------------------------
/*
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 "../CPUMeter.h"

View File

@@ -35,7 +35,7 @@
namespace beast {
RelativeTime::RelativeTime (const double secs) noexcept
RelativeTime::RelativeTime (const RelativeTime::value_type secs) noexcept
: numSeconds (secs)
{
}
@@ -59,27 +59,27 @@ RelativeTime RelativeTime::milliseconds (const int64 milliseconds) noexcept
return RelativeTime (milliseconds * 0.001);
}
RelativeTime RelativeTime::seconds (double s) noexcept
RelativeTime RelativeTime::seconds (RelativeTime::value_type s) noexcept
{
return RelativeTime (s);
}
RelativeTime RelativeTime::minutes (const double numberOfMinutes) noexcept
RelativeTime RelativeTime::minutes (const RelativeTime::value_type numberOfMinutes) noexcept
{
return RelativeTime (numberOfMinutes * 60.0);
}
RelativeTime RelativeTime::hours (const double numberOfHours) noexcept
RelativeTime RelativeTime::hours (const RelativeTime::value_type numberOfHours) noexcept
{
return RelativeTime (numberOfHours * (60.0 * 60.0));
}
RelativeTime RelativeTime::days (const double numberOfDays) noexcept
RelativeTime RelativeTime::days (const RelativeTime::value_type numberOfDays) noexcept
{
return RelativeTime (numberOfDays * (60.0 * 60.0 * 24.0));
}
RelativeTime RelativeTime::weeks (const double numberOfWeeks) noexcept
RelativeTime RelativeTime::weeks (const RelativeTime::value_type numberOfWeeks) noexcept
{
return RelativeTime (numberOfWeeks * (60.0 * 60.0 * 24.0 * 7.0));
}
@@ -91,22 +91,22 @@ int64 RelativeTime::inMilliseconds() const noexcept
return (int64) (numSeconds * 1000.0);
}
double RelativeTime::inMinutes() const noexcept
RelativeTime::value_type RelativeTime::inMinutes() const noexcept
{
return numSeconds / 60.0;
}
double RelativeTime::inHours() const noexcept
RelativeTime::value_type RelativeTime::inHours() const noexcept
{
return numSeconds / (60.0 * 60.0);
}
double RelativeTime::inDays() const noexcept
RelativeTime::value_type RelativeTime::inDays() const noexcept
{
return numSeconds / (60.0 * 60.0 * 24.0);
}
double RelativeTime::inWeeks() const noexcept
RelativeTime::value_type RelativeTime::inWeeks() const noexcept
{
return numSeconds / (60.0 * 60.0 * 24.0 * 7.0);
}
@@ -125,12 +125,12 @@ RelativeTime RelativeTime::operator-= (RelativeTime t) noexcept
numSeconds -= t.numSeconds; return *this;
}
RelativeTime RelativeTime::operator+= (const double secs) noexcept
RelativeTime RelativeTime::operator+= (const RelativeTime::value_type secs) noexcept
{
numSeconds += secs; return *this;
}
RelativeTime RelativeTime::operator-= (const double secs) noexcept
RelativeTime RelativeTime::operator-= (const RelativeTime::value_type secs) noexcept
{
numSeconds -= secs; return *this;
}
@@ -256,71 +256,126 @@ std::string RelativeTime::to_string () const
}
}
#if BEAST_WINDOWS
#include <Windows.h>
#include <windows.h>
namespace beast {
namespace detail {
RelativeTime RelativeTime::fromStartup ()
static double monotonicCurrentTimeInSeconds()
{
ULONGLONG ticks (GetTickCount64());
return RelativeTime (ticks / 1000.0);
return GetTickCount64() / 1000.0;
}
}
}
#elif BEAST_MAC || BEAST_IOS
#include <mach/mach_time.h>
#include <mach/mach.h>
namespace beast {
namespace detail {
static double monotonicCurrentTimeInSeconds()
{
struct StaticInitializer
{
StaticInitializer ()
{
double numerator;
double denominator;
mach_timebase_info_data_t timebase;
(void) mach_timebase_info (&timebase);
if (timebase.numer % 1000000 == 0)
{
numerator = timebase.numer / 1000000.0;
denominator = timebase.denom * 1000.0;
}
else
{
numerator = timebase.numer;
// VFALCO NOTE I don't understand this code
//denominator = timebase.denom * (uint64) 1000000 * 1000.0;
denominator = timebase.denom * 1000000000.0;
}
ratio = numerator / denominator;
}
double ratio;
};
static StaticInitializer const data;
return mach_absolute_time() * data.ratio;
}
}
}
#else
#include <time.h>
namespace beast {
namespace detail {
// Converts a timespec to a RelativeTme
static RelativeTime toRelativeTime (timespec const& ts)
static double monotonicCurrentTimeInSeconds()
{
return RelativeTime (ts.tv_sec +
ts.tv_nsec / 1000000000.0);
timespec t;
clock_gettime (CLOCK_MONOTONIC, &t);
return t.tv_sec + t.tv_nsec / 1000000000.0;
}
}
}
#endif
namespace beast {
namespace detail {
// Records and returns the time from process startup
static RelativeTime getStartupTime()
static double getStartupTime()
{
struct StartupTime
{
StartupTime ()
{ clock_gettime (CLOCK_MONOTONIC, &ts); }
timespec ts;
};
struct StaticInitializer
{
StaticInitializer ()
{
when = detail::monotonicCurrentTimeInSeconds();
}
double when;
};
static StartupTime startupTime;
static StaticInitializer const data;
return toRelativeTime (startupTime.ts);
return data.when;
}
// Used to call getStartupTime as early as possible
struct StartupTimeStaticInitializer
{
StartupTimeStaticInitializer ()
{ getStartupTime(); }
StartupTimeStaticInitializer ()
{
getStartupTime();
}
};
static StartupTimeStaticInitializer startupTimeStaticInitializer;
}
RelativeTime RelativeTime::fromStartup ()
{
timespec ts;
clock_gettime (CLOCK_MONOTONIC, &ts);
return detail::toRelativeTime (ts) - detail::getStartupTime();
return RelativeTime (
detail::monotonicCurrentTimeInSeconds() - detail::getStartupTime());
}
}
#endif

View File

@@ -0,0 +1,98 @@
//------------------------------------------------------------------------------
/*
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 "../abstract_clock.h"
#include "../manual_clock.h"
#include <thread>
#include <string>
#include <sstream>
namespace beast {
class abstract_clock_tests : public UnitTest
{
public:
void test (abstract_clock <std::chrono::seconds>& c)
{
{
auto const t1 (c.now ());
std::this_thread::sleep_for (
std::chrono::milliseconds (1500));
auto const t2 (c.now ());
std::stringstream ss;
ss <<
"t1= " << c.to_string (t1) <<
", t2= " << c.to_string (t2) <<
", elapsed= " << (t2 - t1);
logMessage (ss.str());
}
}
void test_manual ()
{
typedef manual_clock <std::chrono::seconds> clock_type;
clock_type c;
std::stringstream ss;
ss << "now() = " << c.to_string (c.now ()) << std::endl;
c.set (clock_type::time_point (std::chrono::seconds (1)));
ss << "now() = " << c.to_string (c.now ()) << std::endl;
c.set (clock_type::time_point (std::chrono::seconds (2)));
ss << "now() = " << c.to_string (c.now ()) << std::endl;
logMessage (ss.str());
}
void runTest ()
{
beginTestCase ("Syntax");
logMessage ("steady_clock");
test (get_abstract_clock <std::chrono::steady_clock,
std::chrono::seconds> ());
logMessage ("system_clock");
test (get_abstract_clock <std::chrono::system_clock,
std::chrono::seconds> ());
logMessage ("high_resolution_clock");
test (get_abstract_clock <std::chrono::high_resolution_clock,
std::chrono::seconds> ());
logMessage ("manual_clock");
test_manual ();
pass ();
}
abstract_clock_tests ()
: UnitTest ("abstract_clock", "beast", runManual)
{
}
};
static abstract_clock_tests abstract_clock_tests_;
}

View File

@@ -0,0 +1,46 @@
//------------------------------------------------------------------------------
/*
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 "../basic_seconds_clock.h"
#include "../../Config.h"
#include "../../../modules/beast_core/beast_core.h" // for UnitTest
namespace beast {
class basic_seconds_clock_Tests : public UnitTest
{
public:
void runTest ()
{
beginTestCase ("now");
basic_seconds_clock <std::chrono::steady_clock>::now ();
pass ();
}
basic_seconds_clock_Tests() : UnitTest("basic_seconds_clock", "beast")
{
}
};
static basic_seconds_clock_Tests basic_seconds_clock_tests;
}

View File

@@ -0,0 +1,41 @@
//------------------------------------------------------------------------------
/*
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.
*/
//==============================================================================
// chrono_io
//
// (C) Copyright Howard Hinnant
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
#include "../chrono_io.h"
//_LIBCPP_BEGIN_NAMESPACE_STD
namespace std {
namespace chrono
{
locale::id
durationpunct::id;
} // chrono
//_LIBCPP_END_NAMESPACE_STD
}

View File

@@ -0,0 +1,92 @@
//------------------------------------------------------------------------------
/*
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_CHRONO_MANUAL_CLOCK_H_INCLUDED
#define BEAST_CHRONO_MANUAL_CLOCK_H_INCLUDED
#include "abstract_clock.h"
namespace beast {
/** Manual clock implementation.
This concrete class implements the @ref abstract_clock interface and
allows the time to be advanced manually, mainly for the purpose of
providing a clock in unit tests.
@tparam The length of time, in seconds, corresponding to one tick.
*/
template <class Duration, bool IsSteady = true>
class manual_clock : public abstract_clock <Duration>
{
public:
using typename abstract_clock <Duration>::rep;
using typename abstract_clock <Duration>::duration;
using typename abstract_clock <Duration>::time_point;
explicit manual_clock (time_point const& t = time_point (Duration (0)))
: m_now (t)
{
}
bool is_steady () const
{
return IsSteady;
}
time_point now () const
{
return m_now;
}
std::string to_string (time_point const& tp) const
{
std::stringstream ss;
ss << tp.time_since_epoch() << " from start";
return ss.str ();
}
/** Set the current time of the manual clock.
Precondition:
! IsSteady || t > now()
*/
void set (time_point const& t)
{
//if (IsSteady)
m_now = t;
}
/** Convenience for setting the time using a duration in @ref rep units. */
void set (rep v)
{
set (time_point (duration (v)));
}
/** Convenience for advancing the clock by one. */
manual_clock& operator++ ()
{
m_now += duration (1);
return *this;
}
private:
time_point m_now;
};
}
#endif

View File

@@ -0,0 +1,622 @@
//------------------------------------------------------------------------------
/*
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.
*/
//==============================================================================
// ratio_io
//
// (C) Copyright Howard Hinnant
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
#ifndef BEAST_CHRONO_RATIO_IO_H_INCLUDED
#define BEAST_CHRONO_RATIO_IO_H_INCLUDED
/*
ratio_io synopsis
#include <ratio>
#include <string>
namespace std
{
template <class Ratio, class charT>
struct ratio_string
{
static basic_string<charT> symbol();
static basic_string<charT> prefix();
};
} // std
*/
#include <ratio>
#include <string>
#include <sstream>
//_LIBCPP_BEGIN_NAMESPACE_STD
namespace std {
template <class _Ratio, class _CharT>
struct ratio_string
{
static basic_string<_CharT> symbol() {return prefix();}
static basic_string<_CharT> prefix();
};
template <class _Ratio, class _CharT>
basic_string<_CharT>
ratio_string<_Ratio, _CharT>::prefix()
{
basic_ostringstream<_CharT> __os;
__os << _CharT('[') << _Ratio::num << _CharT('/')
<< _Ratio::den << _CharT(']');
return __os.str();
}
// atto
template <>
struct ratio_string<atto, char>
{
static string symbol() {return string(1, 'a');}
static string prefix() {return string("atto");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<atto, char16_t>
{
static u16string symbol() {return u16string(1, u'a');}
static u16string prefix() {return u16string(u"atto");}
};
template <>
struct ratio_string<atto, char32_t>
{
static u32string symbol() {return u32string(1, U'a');}
static u32string prefix() {return u32string(U"atto");}
};
#endif
template <>
struct ratio_string<atto, wchar_t>
{
static wstring symbol() {return wstring(1, L'a');}
static wstring prefix() {return wstring(L"atto");}
};
// femto
template <>
struct ratio_string<femto, char>
{
static string symbol() {return string(1, 'f');}
static string prefix() {return string("femto");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<femto, char16_t>
{
static u16string symbol() {return u16string(1, u'f');}
static u16string prefix() {return u16string(u"femto");}
};
template <>
struct ratio_string<femto, char32_t>
{
static u32string symbol() {return u32string(1, U'f');}
static u32string prefix() {return u32string(U"femto");}
};
#endif
template <>
struct ratio_string<femto, wchar_t>
{
static wstring symbol() {return wstring(1, L'f');}
static wstring prefix() {return wstring(L"femto");}
};
// pico
template <>
struct ratio_string<pico, char>
{
static string symbol() {return string(1, 'p');}
static string prefix() {return string("pico");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<pico, char16_t>
{
static u16string symbol() {return u16string(1, u'p');}
static u16string prefix() {return u16string(u"pico");}
};
template <>
struct ratio_string<pico, char32_t>
{
static u32string symbol() {return u32string(1, U'p');}
static u32string prefix() {return u32string(U"pico");}
};
#endif
template <>
struct ratio_string<pico, wchar_t>
{
static wstring symbol() {return wstring(1, L'p');}
static wstring prefix() {return wstring(L"pico");}
};
// nano
template <>
struct ratio_string<nano, char>
{
static string symbol() {return string(1, 'n');}
static string prefix() {return string("nano");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<nano, char16_t>
{
static u16string symbol() {return u16string(1, u'n');}
static u16string prefix() {return u16string(u"nano");}
};
template <>
struct ratio_string<nano, char32_t>
{
static u32string symbol() {return u32string(1, U'n');}
static u32string prefix() {return u32string(U"nano");}
};
#endif
template <>
struct ratio_string<nano, wchar_t>
{
static wstring symbol() {return wstring(1, L'n');}
static wstring prefix() {return wstring(L"nano");}
};
// micro
template <>
struct ratio_string<micro, char>
{
static string symbol() {return string("\xC2\xB5");}
static string prefix() {return string("micro");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<micro, char16_t>
{
static u16string symbol() {return u16string(1, u'\xB5');}
static u16string prefix() {return u16string(u"micro");}
};
template <>
struct ratio_string<micro, char32_t>
{
static u32string symbol() {return u32string(1, U'\xB5');}
static u32string prefix() {return u32string(U"micro");}
};
#endif
template <>
struct ratio_string<micro, wchar_t>
{
static wstring symbol() {return wstring(1, L'\xB5');}
static wstring prefix() {return wstring(L"micro");}
};
// milli
template <>
struct ratio_string<milli, char>
{
static string symbol() {return string(1, 'm');}
static string prefix() {return string("milli");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<milli, char16_t>
{
static u16string symbol() {return u16string(1, u'm');}
static u16string prefix() {return u16string(u"milli");}
};
template <>
struct ratio_string<milli, char32_t>
{
static u32string symbol() {return u32string(1, U'm');}
static u32string prefix() {return u32string(U"milli");}
};
#endif
template <>
struct ratio_string<milli, wchar_t>
{
static wstring symbol() {return wstring(1, L'm');}
static wstring prefix() {return wstring(L"milli");}
};
// centi
template <>
struct ratio_string<centi, char>
{
static string symbol() {return string(1, 'c');}
static string prefix() {return string("centi");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<centi, char16_t>
{
static u16string symbol() {return u16string(1, u'c');}
static u16string prefix() {return u16string(u"centi");}
};
template <>
struct ratio_string<centi, char32_t>
{
static u32string symbol() {return u32string(1, U'c');}
static u32string prefix() {return u32string(U"centi");}
};
#endif
template <>
struct ratio_string<centi, wchar_t>
{
static wstring symbol() {return wstring(1, L'c');}
static wstring prefix() {return wstring(L"centi");}
};
// deci
template <>
struct ratio_string<deci, char>
{
static string symbol() {return string(1, 'd');}
static string prefix() {return string("deci");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<deci, char16_t>
{
static u16string symbol() {return u16string(1, u'd');}
static u16string prefix() {return u16string(u"deci");}
};
template <>
struct ratio_string<deci, char32_t>
{
static u32string symbol() {return u32string(1, U'd');}
static u32string prefix() {return u32string(U"deci");}
};
#endif
template <>
struct ratio_string<deci, wchar_t>
{
static wstring symbol() {return wstring(1, L'd');}
static wstring prefix() {return wstring(L"deci");}
};
// deca
template <>
struct ratio_string<deca, char>
{
static string symbol() {return string("da");}
static string prefix() {return string("deca");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<deca, char16_t>
{
static u16string symbol() {return u16string(u"da");}
static u16string prefix() {return u16string(u"deca");}
};
template <>
struct ratio_string<deca, char32_t>
{
static u32string symbol() {return u32string(U"da");}
static u32string prefix() {return u32string(U"deca");}
};
#endif
template <>
struct ratio_string<deca, wchar_t>
{
static wstring symbol() {return wstring(L"da");}
static wstring prefix() {return wstring(L"deca");}
};
// hecto
template <>
struct ratio_string<hecto, char>
{
static string symbol() {return string(1, 'h');}
static string prefix() {return string("hecto");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<hecto, char16_t>
{
static u16string symbol() {return u16string(1, u'h');}
static u16string prefix() {return u16string(u"hecto");}
};
template <>
struct ratio_string<hecto, char32_t>
{
static u32string symbol() {return u32string(1, U'h');}
static u32string prefix() {return u32string(U"hecto");}
};
#endif
template <>
struct ratio_string<hecto, wchar_t>
{
static wstring symbol() {return wstring(1, L'h');}
static wstring prefix() {return wstring(L"hecto");}
};
// kilo
template <>
struct ratio_string<kilo, char>
{
static string symbol() {return string(1, 'k');}
static string prefix() {return string("kilo");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<kilo, char16_t>
{
static u16string symbol() {return u16string(1, u'k');}
static u16string prefix() {return u16string(u"kilo");}
};
template <>
struct ratio_string<kilo, char32_t>
{
static u32string symbol() {return u32string(1, U'k');}
static u32string prefix() {return u32string(U"kilo");}
};
#endif
template <>
struct ratio_string<kilo, wchar_t>
{
static wstring symbol() {return wstring(1, L'k');}
static wstring prefix() {return wstring(L"kilo");}
};
// mega
template <>
struct ratio_string<mega, char>
{
static string symbol() {return string(1, 'M');}
static string prefix() {return string("mega");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<mega, char16_t>
{
static u16string symbol() {return u16string(1, u'M');}
static u16string prefix() {return u16string(u"mega");}
};
template <>
struct ratio_string<mega, char32_t>
{
static u32string symbol() {return u32string(1, U'M');}
static u32string prefix() {return u32string(U"mega");}
};
#endif
template <>
struct ratio_string<mega, wchar_t>
{
static wstring symbol() {return wstring(1, L'M');}
static wstring prefix() {return wstring(L"mega");}
};
// giga
template <>
struct ratio_string<giga, char>
{
static string symbol() {return string(1, 'G');}
static string prefix() {return string("giga");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<giga, char16_t>
{
static u16string symbol() {return u16string(1, u'G');}
static u16string prefix() {return u16string(u"giga");}
};
template <>
struct ratio_string<giga, char32_t>
{
static u32string symbol() {return u32string(1, U'G');}
static u32string prefix() {return u32string(U"giga");}
};
#endif
template <>
struct ratio_string<giga, wchar_t>
{
static wstring symbol() {return wstring(1, L'G');}
static wstring prefix() {return wstring(L"giga");}
};
// tera
template <>
struct ratio_string<tera, char>
{
static string symbol() {return string(1, 'T');}
static string prefix() {return string("tera");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<tera, char16_t>
{
static u16string symbol() {return u16string(1, u'T');}
static u16string prefix() {return u16string(u"tera");}
};
template <>
struct ratio_string<tera, char32_t>
{
static u32string symbol() {return u32string(1, U'T');}
static u32string prefix() {return u32string(U"tera");}
};
#endif
template <>
struct ratio_string<tera, wchar_t>
{
static wstring symbol() {return wstring(1, L'T');}
static wstring prefix() {return wstring(L"tera");}
};
// peta
template <>
struct ratio_string<peta, char>
{
static string symbol() {return string(1, 'P');}
static string prefix() {return string("peta");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<peta, char16_t>
{
static u16string symbol() {return u16string(1, u'P');}
static u16string prefix() {return u16string(u"peta");}
};
template <>
struct ratio_string<peta, char32_t>
{
static u32string symbol() {return u32string(1, U'P');}
static u32string prefix() {return u32string(U"peta");}
};
#endif
template <>
struct ratio_string<peta, wchar_t>
{
static wstring symbol() {return wstring(1, L'P');}
static wstring prefix() {return wstring(L"peta");}
};
// exa
template <>
struct ratio_string<exa, char>
{
static string symbol() {return string(1, 'E');}
static string prefix() {return string("exa");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<exa, char16_t>
{
static u16string symbol() {return u16string(1, u'E');}
static u16string prefix() {return u16string(u"exa");}
};
template <>
struct ratio_string<exa, char32_t>
{
static u32string symbol() {return u32string(1, U'E');}
static u32string prefix() {return u32string(U"exa");}
};
#endif
template <>
struct ratio_string<exa, wchar_t>
{
static wstring symbol() {return wstring(1, L'E');}
static wstring prefix() {return wstring(L"exa");}
};
//_LIBCPP_END_NAMESPACE_STD
}
#endif // _RATIO_IO

View File

@@ -30,6 +30,8 @@
#error "PlatformConfig.h must come first!"
#endif
#include <assert.h>
// This file defines miscellaneous macros for debugging, assertions, etc.
#if BEAST_FORCE_DEBUG
@@ -107,8 +109,9 @@ extern void beast_reportFatalError (char const* message, char const* fileName, i
This is only compiled in a debug build.
@see Logger::outputDebugString
*/
#define DBG(dbgtext) { beast::String tempDbgBuf; tempDbgBuf << dbgtext; beast::Logger::outputDebugString (tempDbgBuf); }
#define BDBG(dbgtext) { beast::String tempDbgBuf; tempDbgBuf << dbgtext; beast::Logger::outputDebugString (tempDbgBuf); }
#if 0
/** This will always cause an assertion failure.
It is only compiled in a debug build, (unless BEAST_LOG_ASSERTIONS is enabled for your build).
@see bassert
@@ -122,12 +125,17 @@ extern void beast_reportFatalError (char const* message, char const* fileName, i
@see bassertfalse
*/
#define bassert(expression) { if (! (expression)) beast_reportFatalError(#expression,__FILE__,__LINE__); }
#else
#define bassertfalse assert(false)
#define bassert(expression) assert(expression)
#endif
#else
// If debugging is disabled, these dummy debug and assertion macros are used..
#define DBG(dbgtext)
#define BDBG(dbgtext)
#define bassertfalse { beast_LogCurrentAssertion }
# if BEAST_LOG_ASSERTIONS

View File

@@ -81,6 +81,10 @@
#define BEAST_ZLIB_INCLUDE_PATH <zlib.h>
#endif
#ifndef BEAST_SQLITE_FORCE_NDEBUG
#define BEAST_SQLITE_FORCE_NDEBUG 0
#endif
#ifndef BEAST_STRING_UTF_TYPE
#define BEAST_STRING_UTF_TYPE 8
#endif

View File

@@ -174,7 +174,6 @@
#ifdef __clang__
#define BEAST_CLANG 1
#define BEAST_GCC 1
#elif defined (__GNUC__)
#define BEAST_GCC 1
#elif defined (_MSC_VER)

View File

@@ -18,3 +18,7 @@
//==============================================================================
// Microsoft Visual C++ compiler configuration
#ifndef noexcept
# define noexcept throw()
#endif

View File

@@ -0,0 +1,25 @@
//------------------------------------------------------------------------------
/*
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 "BeastConfig.h"
#include "impl/aged_associative_container.cpp"
#include "tests/buffer_view.test.cpp"

View File

@@ -0,0 +1,35 @@
//------------------------------------------------------------------------------
/*
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_CONTAINER_AGED_CONTAINER_H_INCLUDED
#define BEAST_CONTAINER_AGED_CONTAINER_H_INCLUDED
#include <type_traits>
namespace beast {
template <class T>
struct is_aged_container
: std::false_type
{
};
}
#endif

View File

@@ -0,0 +1,51 @@
//------------------------------------------------------------------------------
/*
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_CONTAINER_AGED_CONTAINER_UTILITY_H_INCLUDED
#define BEAST_CONTAINER_AGED_CONTAINER_UTILITY_H_INCLUDED
#include "aged_container.h"
#include <type_traits>
namespace beast {
/** Expire aged container items past the specified age. */
template <class AgedContainer, class Rep, class Period>
typename std::enable_if <
is_aged_container <AgedContainer>::value,
std::size_t
>::type
expire (AgedContainer& c, std::chrono::duration <Rep, Period> const& age)
{
std::size_t n (0);
auto const expired (c.clock().now() - age);
for (auto iter (c.chronological.cbegin());
iter != c.chronological.cend() &&
iter.when() <= expired;)
{
iter = c.erase (iter);
++n;
}
return n;
}
}
#endif

View File

@@ -0,0 +1,43 @@
//------------------------------------------------------------------------------
/*
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_CONTAINER_AGED_MAP_H_INCLUDED
#define BEAST_CONTAINER_AGED_MAP_H_INCLUDED
#include "detail/aged_ordered_container.h"
#include <chrono>
#include <functional>
#include <memory>
namespace beast {
template <
class Key,
class T,
class Duration = std::chrono::seconds,
class Compare = std::less <Key>,
class Allocator = std::allocator <std::pair <Key const, T>>
>
using aged_map = detail::aged_ordered_container <
false, true, Key, T, Duration, Compare, Allocator>;
}
#endif

View File

@@ -0,0 +1,43 @@
//------------------------------------------------------------------------------
/*
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_CONTAINER_AGED_MULTIMAP_H_INCLUDED
#define BEAST_CONTAINER_AGED_MULTIMAP_H_INCLUDED
#include "detail/aged_ordered_container.h"
#include <chrono>
#include <functional>
#include <memory>
namespace beast {
template <
class Key,
class T,
class Duration = std::chrono::seconds,
class Compare = std::less <Key>,
class Allocator = std::allocator <std::pair <Key const, T>>
>
using aged_multimap = detail::aged_ordered_container <
true, true, Key, T, Duration, Compare, Allocator>;
}
#endif

View File

@@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
/*
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_CONTAINER_AGED_MULTISET_H_INCLUDED
#define BEAST_CONTAINER_AGED_MULTISET_H_INCLUDED
#include "detail/aged_ordered_container.h"
#include <chrono>
#include <functional>
#include <memory>
namespace beast {
template <
class Key,
class Duration = std::chrono::seconds,
class Compare = std::less <Key>,
class Allocator = std::allocator <Key>
>
using aged_multiset = detail::aged_ordered_container <
true, false, Key, void, Duration, Compare, Allocator>;
}
#endif

View File

@@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
/*
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_CONTAINER_AGED_SET_H_INCLUDED
#define BEAST_CONTAINER_AGED_SET_H_INCLUDED
#include "detail/aged_ordered_container.h"
#include <chrono>
#include <functional>
#include <memory>
namespace beast {
template <
class Key,
class Duration = std::chrono::seconds,
class Compare = std::less <Key>,
class Allocator = std::allocator <Key>
>
using aged_set = detail::aged_ordered_container <
false, false, Key, void, Duration, Compare, Allocator>;
}
#endif

View File

@@ -0,0 +1,44 @@
//------------------------------------------------------------------------------
/*
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_CONTAINER_AGED_UNORDERED_MAP_H_INCLUDED
#define BEAST_CONTAINER_AGED_UNORDERED_MAP_H_INCLUDED
#include "detail/aged_unordered_container.h"
#include <chrono>
#include <functional>
#include <memory>
namespace beast {
template <
class Key,
class T,
class Duration = std::chrono::seconds,
class Hash = std::hash <Key>,
class KeyEqual = std::equal_to <Key>,
class Allocator = std::allocator <std::pair <Key const, T>>
>
using aged_unordered_map = detail::aged_unordered_container <
false, true, Key, T, Duration, Hash, KeyEqual, Allocator>;
}
#endif

View File

@@ -0,0 +1,44 @@
//------------------------------------------------------------------------------
/*
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_CONTAINER_AGED_UNORDERED_MULTIMAP_H_INCLUDED
#define BEAST_CONTAINER_AGED_UNORDERED_MULTIMAP_H_INCLUDED
#include "detail/aged_unordered_container.h"
#include <chrono>
#include <functional>
#include <memory>
namespace beast {
template <
class Key,
class T,
class Duration = std::chrono::seconds,
class Hash = std::hash <Key>,
class KeyEqual = std::equal_to <Key>,
class Allocator = std::allocator <std::pair <Key const, T>>
>
using aged_unordered_multimap = detail::aged_unordered_container <
true, true, Key, T, Duration, Hash, KeyEqual, Allocator>;
}
#endif

View File

@@ -0,0 +1,43 @@
//------------------------------------------------------------------------------
/*
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_CONTAINER_AGED_UNORDERED_MULTISET_H_INCLUDED
#define BEAST_CONTAINER_AGED_UNORDERED_MULTISET_H_INCLUDED
#include "detail/aged_unordered_container.h"
#include <chrono>
#include <functional>
#include <memory>
namespace beast {
template <
class Key,
class Duration = std::chrono::seconds,
class Hash = std::hash <Key>,
class KeyEqual = std::equal_to <Key>,
class Allocator = std::allocator <Key>
>
using aged_unordered_multiset = detail::aged_unordered_container <
true, false, Key, void, Duration, Hash, KeyEqual, Allocator>;
}
#endif

View File

@@ -0,0 +1,43 @@
//------------------------------------------------------------------------------
/*
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_CONTAINER_AGED_UNORDERED_SET_H_INCLUDED
#define BEAST_CONTAINER_AGED_UNORDERED_SET_H_INCLUDED
#include "detail/aged_unordered_container.h"
#include <chrono>
#include <functional>
#include <memory>
namespace beast {
template <
class Key,
class Duration = std::chrono::seconds,
class Hash = std::hash <Key>,
class KeyEqual = std::equal_to <Key>,
class Allocator = std::allocator <Key>
>
using aged_unordered_set = detail::aged_unordered_container <
false, false, Key, void, Duration, Hash, KeyEqual, Allocator>;
}
#endif

View File

@@ -0,0 +1,519 @@
//------------------------------------------------------------------------------
/*
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_CONTAINER_BUFFER_VIEW_H_INCLUDED
#define BEAST_CONTAINER_BUFFER_VIEW_H_INCLUDED
#include "../Config.h"
#include "../cxx14/algorithm.h" // <algorithm>
#include <cstddef>
#include <iterator>
#include <memory>
#include <string>
#include <vector>
#include "../cxx14/type_traits.h" // <type_traits>
namespace beast {
namespace detail {
template <class T, class U,
bool = std::is_const <std::remove_reference_t <T>>::value>
struct apply_const
{
typedef U type;
};
template <class T, class U>
struct apply_const <T, U, true>
{
typedef const U type;
};
// is_contiguous is true if C is a contiguous container
template <class C>
struct is_contiguous
: public std::false_type
{
};
template <class C>
struct is_contiguous <C const>
: public is_contiguous <C>
{
};
template <class T, class Alloc>
struct is_contiguous <std::vector <T, Alloc>>
: public std::true_type
{
};
template <class CharT, class Traits, class Alloc>
struct is_contiguous <std::basic_string<
CharT, Traits, Alloc>>
: public std::true_type
{
};
template <class T, std::size_t N>
struct is_contiguous <std::array<T, N>>
: public std::true_type
{
};
// True if T is const or U is not const
template <class T, class U>
struct buffer_view_const_compatible : std::integral_constant <bool,
std::is_const<T>::value || ! std::is_const<U>::value
>
{
};
// True if T and U are the same or differ only in const, or
// if T and U are equally sized integral types.
template <class T, class U>
struct buffer_view_ptr_compatible : std::integral_constant <bool,
(std::is_same <std::remove_const <T>, std::remove_const <U>>::value) ||
(std::is_integral <T>::value && std::is_integral <U>::value &&
sizeof (U) == sizeof (T))
>
{
};
// Determine if buffer_view <T, ..> is constructible from U*
template <class T, class U>
struct buffer_view_convertible : std::integral_constant <bool,
buffer_view_const_compatible <T, U>::value &&
buffer_view_ptr_compatible <T, U>::value
>
{
};
// True if C is a container that can be used to construct a buffer_view<T>
template <class T, class C>
struct buffer_view_container_compatible : std::integral_constant <bool,
is_contiguous <C>::value && buffer_view_convertible <T,
typename apply_const <C, typename C::value_type>::type>::value
>
{
};
} // detail
struct buffer_view_default_tag
{
};
//------------------------------------------------------------------------------
/** A view into a range of contiguous container elements.
The size of the view is determined at the time of construction.
This tries to emulate the interface of std::vector as closely as possible,
with the constraint that the size of the container cannot be changed.
@tparam T The underlying element type. If T is const, member functions
which can modify elements are removed from the interface.
@tparam Tag A type used to prevent two views with the same T from being
comparable or assignable.
*/
template <
class T,
class Tag = buffer_view_default_tag
>
class buffer_view
{
private:
T* m_base;
std::size_t m_size;
static_assert (std::is_same <T, std::remove_reference_t <T>>::value,
"T may not be a reference type");
static_assert (! std::is_same <T, void>::value,
"T may not be void");
static_assert (std::is_same <std::add_const_t <T>,
std::remove_reference_t <T> const>::value,
"Expected std::add_const to produce T const");
template <class Iter>
void
assign (Iter first, Iter last) noexcept
{
typedef typename std::iterator_traits <Iter>::value_type U;
static_assert (detail::buffer_view_const_compatible <T, U>::value,
"Cannot convert from 'U const' to 'T', "
"conversion loses const qualifiers");
static_assert (detail::buffer_view_ptr_compatible <T, U>::value,
"Cannot convert from 'U*' to 'T*, "
"types are incompatible");
if (first == last)
{
m_base = nullptr;
m_size = 0;
}
else
{
#if 0
// fails on gcc
m_base = reinterpret_cast <T*> (
std::addressof (*first));
#else
m_base = reinterpret_cast <T*> (&*first);
#endif
m_size = std::distance (first, last);
}
}
public:
typedef T value_type;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef T& reference;
typedef T const& const_reference;
typedef T* pointer;
typedef T const* const_pointer;
typedef T* iterator;
typedef T const* const_iterator;
typedef std::reverse_iterator <iterator> reverse_iterator;
typedef std::reverse_iterator <const_iterator> const_reverse_iterator;
// default construct
buffer_view () noexcept
: m_base (nullptr)
, m_size (0)
{
}
// copy construct
template <class U,
class = std::enable_if_t <
detail::buffer_view_convertible <T, U>::value>
>
buffer_view (buffer_view <U, Tag> v) noexcept
{
assign (v.begin(), v.end());
}
// construct from container
template <class C,
class = std::enable_if_t <
detail::buffer_view_container_compatible <T, C>::value
>
>
buffer_view (C& c) noexcept
{
assign (c.begin(), c.end());
}
// construct from pointer range
template <class U,
class = std::enable_if_t <
detail::buffer_view_convertible <T, U>::value>
>
buffer_view (U* first, U* last) noexcept
{
assign (first, last);
}
// construct from base and size
template <class U,
class = std::enable_if_t <
detail::buffer_view_convertible <T, U>::value>
>
buffer_view (U* u, std::size_t n) noexcept
: m_base (u)
, m_size (n)
{
}
// assign from container
template <class C,
class = std::enable_if_t <
detail::buffer_view_container_compatible <T, C>::value
>
>
buffer_view&
operator= (C& c) noexcept
{
assign (c.begin(), c.end());
return *this;
}
//
// Element access
//
reference
at (size_type pos)
{
if (! (pos < size()))
throw std::out_of_range ("bad array index");
return m_base [pos];
}
const_reference
at (size_type pos) const
{
if (! (pos < size()))
throw std::out_of_range ("bad array index");
return m_base [pos];
}
reference
operator[] (size_type pos) noexcept
{
return m_base [pos];
}
const_reference
operator[] (size_type pos) const noexcept
{
return m_base [pos];
}
reference
back() noexcept
{
return m_base [m_size - 1];
}
const_reference
back() const noexcept
{
return m_base [m_size - 1];
}
reference
front() noexcept
{
return *m_base;
}
const_reference
front() const noexcept
{
return *m_base;
}
pointer
data() noexcept
{
return m_base;
}
const_pointer
data() const noexcept
{
return m_base;
}
//
// Iterators
//
iterator
begin() noexcept
{
return m_base;
}
const_iterator
begin() const noexcept
{
return m_base;
}
const_iterator
cbegin() const noexcept
{
return m_base;
}
iterator
end() noexcept
{
return m_base + m_size;
}
const_iterator
end() const noexcept
{
return m_base + m_size;
}
const_iterator
cend() const noexcept
{
return m_base + m_size;
}
reverse_iterator
rbegin() noexcept
{
return reverse_iterator (end());
}
const_reverse_iterator
rbegin() const noexcept
{
return const_reverse_iterator (cend());
}
const_reverse_iterator
crbegin() const noexcept
{
return const_reverse_iterator (cend());
}
reverse_iterator
rend() noexcept
{
return reverse_iterator (begin());
}
const_reverse_iterator
rend() const noexcept
{
return const_reverse_iterator (cbegin());
}
const_reverse_iterator
crend() const noexcept
{
return const_reverse_iterator (cbegin());
}
//
// Capacity
//
bool
empty() const noexcept
{
return m_size == 0;
}
size_type
size() const noexcept
{
return m_size;
}
size_type
max_size() const noexcept
{
return size();
}
size_type
capacity() const noexcept
{
return size();
}
//
// Modifiers
//
template <class U, class K>
friend void swap (buffer_view <U, K>& lhs,
buffer_view <U, K>& rhs) noexcept;
};
//------------------------------------------------------------------------------
template <class T, class Tag>
inline
bool
operator== (buffer_view <T, Tag> lhs, buffer_view <T, Tag> rhs)
{
return std::equal (
lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend());
}
template <class T, class Tag>
inline
bool
operator!= (buffer_view <T, Tag> lhs, buffer_view <T, Tag> rhs)
{
return ! (lhs == rhs);
}
template <class T, class Tag>
inline
bool
operator< (buffer_view <T, Tag> lhs, buffer_view <T, Tag> rhs)
{
return std::lexicographical_compare (
lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend());
}
template <class T, class Tag>
inline
bool
operator>= (buffer_view <T, Tag> lhs, buffer_view <T, Tag> rhs)
{
return ! (lhs < rhs);
}
template <class T, class Tag>
inline
bool
operator> (buffer_view <T, Tag> lhs, buffer_view <T, Tag> rhs)
{
return rhs < lhs;
}
template <class T, class Tag>
inline
bool
operator<= (buffer_view <T, Tag> lhs, buffer_view <T, Tag> rhs)
{
return ! (rhs < lhs);
}
template <class T, class Tag>
inline
void
swap (buffer_view <T, Tag>& lhs, buffer_view <T, Tag>& rhs) noexcept
{
std::swap (lhs.m_base, rhs.m_base);
std::swap (lhs.m_size, rhs.m_size);
}
//------------------------------------------------------------------------------
template <
class T,
class Tag = buffer_view_default_tag
>
using const_buffer_view = buffer_view <
std::add_const_t <T>, Tag>;
}
#endif

View File

@@ -0,0 +1,54 @@
//------------------------------------------------------------------------------
/*
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_CONTAINER_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED
#define BEAST_CONTAINER_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED
#include <type_traits>
namespace beast {
namespace detail {
// Extracts the key portion of value
template <bool maybe_map>
struct aged_associative_container_extract_t
{
template <class Value>
decltype (Value::first) const&
operator() (Value const& value) const
{
return value.first;
}
};
template <>
struct aged_associative_container_extract_t <false>
{
template <class Value>
Value const&
operator() (Value const& value) const
{
return value;
}
};
}
}
#endif

View File

@@ -0,0 +1,156 @@
//------------------------------------------------------------------------------
/*
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_CONTAINER_AGED_CONTAINER_ITERATOR_H_INCLUDED
#define BEAST_CONTAINER_AGED_CONTAINER_ITERATOR_H_INCLUDED
#include <iterator>
#include <type_traits>
namespace beast {
template <bool, bool, class, class, class, class, class>
class aged_ordered_container;
namespace detail {
// Idea for Base template argument to prevent having to repeat
// the base class declaration comes from newbiz on ##c++/Freenode
//
// If Iterator is SCARY then this iterator will be as well.
template <
bool is_const,
class Iterator,
class Base =
std::iterator <
typename std::iterator_traits <Iterator>::iterator_category,
typename std::conditional <is_const,
typename Iterator::value_type::stashed::value_type const,
typename Iterator::value_type::stashed::value_type>::type,
typename std::iterator_traits <Iterator>::difference_type>
>
class aged_container_iterator
: public Base
{
public:
typedef typename Iterator::value_type::stashed::time_point time_point;
aged_container_iterator ()
{
}
template <class OtherIterator, class OtherBase>
aged_container_iterator (aged_container_iterator <
false, OtherIterator, OtherBase> const& other)
: m_iter (other.m_iter)
{
}
template <bool other_is_const, class OtherIterator, class OtherBase>
aged_container_iterator& operator= (aged_container_iterator <
other_is_const, OtherIterator, OtherBase> const& other)
{
m_iter = other.m_iter;
return *this;
}
template <bool other_is_const, class OtherIterator, class OtherBase>
bool operator== (aged_container_iterator <
other_is_const, OtherIterator, OtherBase> const& other) const
{
return m_iter == other.m_iter;
}
template <bool other_is_const, class OtherIterator, class OtherBase>
bool operator!= (aged_container_iterator <
other_is_const, OtherIterator, OtherBase> const& other) const
{
return m_iter != other.m_iter;
}
aged_container_iterator& operator++ ()
{
++m_iter;
return *this;
}
aged_container_iterator operator++ (int)
{
aged_container_iterator const prev (*this);
++m_iter;
return prev;
}
aged_container_iterator& operator-- ()
{
--m_iter;
return *this;
}
aged_container_iterator operator-- (int)
{
aged_container_iterator const prev (*this);
--m_iter;
return prev;
}
typename Base::reference operator* () const
{
return m_iter->value;
}
typename Base::pointer operator-> () const
{
return &m_iter->value;
}
time_point const& when () const
{
return m_iter->when;
}
private:
template <bool, bool, class, class, class, class, class>
friend class aged_ordered_container;
template <bool, bool, class, class, class, class, class, class>
friend class aged_unordered_container;
template <bool, class, class>
friend class aged_container_iterator;
template <class OtherIterator>
aged_container_iterator (OtherIterator const& iter)
: m_iter (iter)
{
}
Iterator const& iterator() const
{
return m_iter;
}
Iterator m_iter;
};
}
}
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,323 @@
//------------------------------------------------------------------------------
/*
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 "../../../modules/beast_core/beast_core.h" // for UnitTest
#include "../buffer_view.h"
#include "../../cxx14/algorithm.h" // <algorithm>
namespace beast {
class buffer_view_Tests : public UnitTest
{
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()
{
beginTestCase ("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()
{
beginTestCase ("std::vector <char>");
testConstruct (
std::vector <char> ({'h', 'e', 'l', 'l', 'o'}));
beginTestCase ("std::string <char>");
testConstruct (
std::basic_string <char> ("hello"));
}
//--------------------------------------------------------------------------
void testCoerce()
{
beginTestCase ("coerce");
std::string const s ("hello");
const_buffer_view <unsigned char> v (s);
pass();
}
//--------------------------------------------------------------------------
void testAssign()
{
beginTestCase ("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 runTest()
{
testEmpty();
testConstruct();
testCoerce();
testAssign();
}
buffer_view_Tests() : UnitTest ("buffer_view", "beast")
{
}
};
static buffer_view_Tests buffer_view_tests;
}

View File

@@ -20,5 +20,4 @@
#ifndef BEAST_CRYPTO_BINARYENCODING_H_INCLUDED
#define BEAST_CRYPTO_BINARYENCODING_H_INCLUDED
#endif

View File

@@ -19,4 +19,9 @@
#include "BeastConfig.h"
#include "../../modules/beast_core/beast_core.h" // for UnitTest
#include "impl/BinaryEncoding.cpp"
#include "impl/MurmurHash.cpp"
#include "impl/Sha256.cpp"
#include "impl/UnsignedInteger.cpp"

View File

@@ -17,15 +17,15 @@
*/
//==============================================================================
#ifndef BEAST_MURMURHASH_H_INCLUDED
#define BEAST_MURMURHASH_H_INCLUDED
#ifndef BEAST_CRYPTO_MURMURHASH_H_INCLUDED
#define BEAST_CRYPTO_MURMURHASH_H_INCLUDED
#include "../CStdInt.h"
// Original source code links in .cpp file
// This file depends on some Beast declarations and defines
namespace Murmur
{
namespace beast {
namespace Murmur {
extern void MurmurHash3_x86_32 (const void* key, int len, uint32 seed, void* out);
extern void MurmurHash3_x86_128 (const void* key, int len, uint32 seed, void* out);
@@ -77,6 +77,7 @@ inline void Hash (const void* key, int len, uint32 seed, HashType* out)
};
}
}
}
#endif

View File

@@ -22,7 +22,8 @@
#include "../Config.h"
#include "../CStdInt.h"
#include "../FixedArray.h"
#include <array>
//------------------------------------------------------------------------------
@@ -36,7 +37,7 @@ enum
};
/** A container suitable for holding the resulting hash. */
typedef FixedArray <uint8, digestLength> digest_type;
typedef std::array <uint8, digestLength> digest_type;
namespace detail {
struct Context
@@ -85,7 +86,7 @@ public:
digest_type& finish (digest_type& digest)
{
finish (digest.c_array());
finish (digest.data());
return digest;
}

View File

@@ -20,6 +20,15 @@
#ifndef BEAST_CRYPTO_UNSIGNEDINTEGER_H_INCLUDED
#define BEAST_CRYPTO_UNSIGNEDINTEGER_H_INCLUDED
#include "../SafeBool.h"
#include "UnsignedIntegerCalc.h"
#include "MurmurHash.h"
#include <cstdint>
#include <memory>
namespace beast {
/** Represents a set of bits of fixed size.
The data is stored in "canonical" format which is network (big endian)
@@ -36,17 +45,17 @@ public:
static std::size_t const size = Bytes;
// The underlying integer type we use when converting to calculation format.
typedef uint32 IntCalcType;
typedef std::uint32_t IntCalcType;
// The type of object resulting from a conversion to calculation format.
typedef UnsignedIntegerCalc <IntCalcType> CalcType;
// Standard container compatibility
typedef uint8 value_type;
typedef std::uint8_t value_type;
typedef value_type* iterator;
typedef value_type const* const_iterator;
/** Hardened hash function for use with HashMap.
/** Hardened hash function for use with hash based containers.
The seed is used to make the hash unpredictable. This prevents
attackers from exploiting crafted inputs to produce degenerate
containers.
@@ -59,21 +68,21 @@ public:
will be generated from the system
@param seedToUse An optional seed to use.
*/
explicit hasher (HashValue seedToUse = Random::getSystemRandom ().nextInt ())
explicit hasher (std::size_t seedToUse = Random::getSystemRandom ().nextInt ())
: m_seed (seedToUse)
{
}
/** Generates a simple hash from an UnsignedInteger. */
HashValue operator() (UnsignedInteger const& key) const
std::size_t operator() (UnsignedInteger const& key) const
{
HashValue hash;
std::size_t hash;
Murmur::Hash (key.cbegin (), key.size, m_seed, &hash);
return hash;
}
private:
HashValue m_seed;
std::size_t m_seed;
};
/** Determins if two UnsignedInteger objects are equal. */
@@ -135,7 +144,8 @@ public:
template <class UnsignedIntegralType>
static UnsignedInteger createFromInteger (UnsignedIntegralType value)
{
static_bassert (Bytes >= sizeof (UnsignedIntegralType));
static_assert (Bytes >= sizeof (UnsignedIntegralType),
"Bytes is too small.");
UnsignedInteger <Bytes> result;
value = toNetworkByteOrder <UnsignedIntegralType> (value);
result.clear ();
@@ -296,4 +306,6 @@ private:
IntCalcType m_values [CalcCount];
};
}
#endif

View File

@@ -20,22 +20,25 @@
#ifndef BEAST_CRYPTO_UNSIGNEDINTEGERCALC_H_INCLUDED
#define BEAST_CRYPTO_UNSIGNEDINTEGERCALC_H_INCLUDED
namespace detail
{
#include <cstdint>
namespace beast {
namespace detail {
template <typename UInt>
struct DoubleWidthUInt;
template <>
struct DoubleWidthUInt <uint16>
struct DoubleWidthUInt <std::uint16_t>
{
typedef uint32 type;
typedef std::uint32_t type;
};
template <>
struct DoubleWidthUInt <uint32>
struct DoubleWidthUInt <std::uint32_t>
{
typedef uint64 type;
typedef std::uint64_t type;
};
}
@@ -331,7 +334,7 @@ public:
}
*lhs++ = UInt (part);
}
bassert (carry == 0) // overflow
bassert (carry == 0); // overflow
return *this;
}
@@ -427,4 +430,6 @@ private:
UInt* m_values;
};
}
#endif

View File

@@ -17,6 +17,14 @@
*/
//==============================================================================
#include "../BinaryEncoding.h"
#include "../UnsignedInteger.h"
#include <cstddef>
#include <string>
namespace beast {
/** Generic algorithms for base encoding and decoding. */
class BinaryEncoding
{
@@ -393,3 +401,5 @@ public:
};
static BinaryEncodingTests BinaryEncodingTests;
}

Some files were not shown because too many files have changed in this diff Show More