Peter Johnson
8d7cdeabbf
Implement remote procedure calls.
2015-08-13 21:32:16 -07:00
Peter Johnson
e9618df1b5
Avoid pointer aliasing for double/bits conversions.
...
Instead use the llvm MathExtras.h functions for this, which use union
aliasing.
2015-08-12 17:15:10 -07:00
Peter Johnson
c34ba968f1
Message: Remove ArrayRef-taking ExecuteRpc/RpcResponse.
2015-08-12 17:11:09 -07:00
Peter Johnson
cd53feb193
Log DEBUG() macros: avoid spurious warnings in release builds.
2015-08-04 20:36:39 -07:00
Peter Johnson
7d409f071e
Add win32 tcpsockets implementation.
2015-08-04 00:01:13 -07:00
Peter Johnson
4146db6fc8
Visual Studio 2013 compilation fixes.
...
- Missing header file callouts in some cases (library deltas)
- Lack of support for auto parameters in lambdas
- Defining of ERROR by windows.h
- Dispatcher::Connection needs a move constructor (default not generated)
- Need explicit enable_if on std::string move template in Value to avoid trying to move const char[] (string literal)
- Compile flags
2015-08-03 01:27:02 -07:00
Peter Johnson
a86f65db1e
Dispatcher: Implement transmit combining.
...
This handles most of the major cases, but not a loop of delete/assign, which
should be uncommon anyway.
2015-08-02 23:21:23 -07:00
Peter Johnson
53a0531def
Storage::ProcessIncoming(): Don't override parameter with local.
2015-08-02 23:20:42 -07:00
Peter Johnson
7db00575c9
NetworkConnection: Add a bit more debugging.
2015-08-02 22:23:14 -07:00
Peter Johnson
5b65bfb64d
Storage: Fix comparison for client update-on-assign.
2015-08-02 22:18:46 -07:00
Peter Johnson
e9073a3cc0
Implement notifiers.
...
The notifier thread is lazily started when the first notifier is added.
This avoids the extra thread/processing overhead when notifiers are not used.
2015-08-02 21:47:01 -07:00
Peter Johnson
538a19fd47
Implement GetConnections().
2015-08-02 10:47:05 -07:00
Peter Johnson
84ff80710c
Refactor TCP-specific pieces of Dispatcher.
2015-08-02 00:33:41 -07:00
Peter Johnson
0dcaf56ed1
Add NetworkAcceptor and NetworkStream interfaces.
...
These allow mocking of TCPAcceptor and TCPStream respectively.
2015-08-02 00:06:27 -07:00
Peter Johnson
6703968f73
Dispatcher: Fix shutdown order race.
...
We need to wait until after the dispatch and client/server threads have
been stopped before closing connections, as these threads can add connections.
2015-08-01 23:37:13 -07:00
Peter Johnson
8ec65dbfc8
Use unique_ptr instead of shared_ptr for m_server_acceptor.
2015-08-01 20:29:16 -07:00
Peter Johnson
35e6400174
Storage: Add vector include.
2015-08-01 16:33:39 -07:00
Peter Johnson
67de7af7b2
Storage: Use unique_ptr instead of shared_ptr for Entry.
2015-08-01 11:47:35 -07:00
Peter Johnson
b5274a495e
Dispatcher: Don't call Storage::GetInstance() internally.
...
This makes it difficult to test. Instead, store reference as member variable,
and populate it at constuction (with an alternate constructor available for
test purposes).
2015-08-01 11:15:04 -07:00
Peter Johnson
11508b77d1
Ensure initial synchronization is atomic.
2015-07-31 23:56:06 -07:00
Peter Johnson
0a10778697
NetworkConnection: Kill write thread when read dies and vice-versa.
2015-07-31 23:40:16 -07:00
Peter Johnson
ecbf76e94b
Update tcpsockets classes to use log framework.
2015-07-31 23:34:54 -07:00
Peter Johnson
6c0103639c
Make LOG() usable from other namespaces.
2015-07-31 23:33:41 -07:00
Peter Johnson
c2eb4a766e
Dispatcher: Provide some INFO-level connection messages.
2015-07-31 23:26:38 -07:00
Peter Johnson
3a71acec52
Automatically reconnect client.
...
Also clean up some condition variable handling to make it more robust.
2015-07-31 23:14:26 -07:00
Peter Johnson
a9af4589ac
Don't send empty message lists from dispatch.
...
This terminates the write thread.
2015-07-31 22:49:43 -07:00
Peter Johnson
4356e313ec
Add logging framework.
...
DEBUG messages are completely optimized out if NDEBUG is defined.
2015-07-31 22:41:26 -07:00
Peter Johnson
ead125555c
Implement client/server handshaking.
2015-07-31 20:32:52 -07:00
Peter Johnson
98ad6d1b43
Message: Handle receiving Server Hello.
2015-07-31 20:14:15 -07:00
Peter Johnson
978cdadda0
Storage::GetEntryType(): Check for null entry.
2015-07-31 14:16:13 -07:00
Peter Johnson
cde7782c21
Make StorageEntry a struct and move into Storage class.
2015-07-31 13:48:33 -07:00
Peter Johnson
138ebf5b4d
Storage: generate messages rather than intermediate updates.
2015-07-31 13:21:19 -07:00
Peter Johnson
a127bca0e4
Push down null check for m_queue_outgoing.
2015-07-30 00:06:50 -07:00
Peter Johnson
83be99e78c
Immediately process incoming messages.
...
This required moving message processing into the Storage class.
2015-07-29 23:45:04 -07:00
Peter Johnson
5b5e3ae6aa
Dispatcher: Start implementing processing of incoming messages.
2015-07-29 20:33:26 -07:00
Peter Johnson
f6576b18f7
Storage: Add more Dispatcher accessors.
2015-07-29 20:33:13 -07:00
Peter Johnson
9a621e9272
Various NetworkConnection improvements.
...
- Keep connection state.
- Store remote id
- Getter for proto_rev
- Cleanup on Stop()
- Cleaner termination of write thread.
2015-07-29 20:31:59 -07:00
Peter Johnson
c01f2977ac
StorageEntry: Make value() const.
2015-07-28 22:29:58 -07:00
Peter Johnson
683c53babc
Message::str(): Return StringRef.
2015-07-28 22:07:02 -07:00
Peter Johnson
5823e3c780
Storage: Add CreateEntry function for Dispatcher use.
2015-07-28 22:06:42 -07:00
Peter Johnson
a0d30ffef1
Storage: Use StringMap instead of ConcurrentQueue for updates.
...
Updates are merged or themselves updated as user code changes. This avoids
the need for the dispatcher to do this and also avoids the need for disabling
updates when the dispatcher isn't running, because there's no risk of memory
usage piling up.
2015-07-26 20:41:48 -07:00
Peter Johnson
fb1b82e239
StorageEntry: Also store copy of name here.
...
This wastes a bit of space but is necessary for assign message generation.
2015-07-26 10:28:20 -07:00
Peter Johnson
3bc5699ba1
Storage: Provide accessor for global mutex.
2015-07-26 09:42:14 -07:00
Peter Johnson
18659257d3
Storage: Make setters globally atomic.
...
Previously, setters were locally but not globally atomic because they
used GetEntry() (globally atomic) in conjunction with locally atomic
gets/sets to the StorageEntry. To support synchronizing network handshakes
they need to be globally atomic.
GetEntry() has been removed due to this issue, so a helper was added to
StorageTest instead.
2015-07-26 09:27:23 -07:00
Peter Johnson
3c7cb363ba
NetworkConnection: Prefer emplace to push.
2015-07-25 10:47:53 -07:00
Peter Johnson
3f24b86875
ITable: Add Persist function to make a key persistent.
2015-07-23 21:53:33 -07:00
Peter Johnson
1368f0ec8f
NetworkTable: Use networktables.ini as persistence filename.
2015-07-23 21:47:54 -07:00
Peter Johnson
196fcf791b
ITable: Const'ify getter functions.
2015-07-23 21:46:30 -07:00
Peter Johnson
8fa0e6c914
Add shims for old NetworkTable interface.
...
This provides classes for virtual subtables using path delimiters within
the global NetworkTable namespace.
2015-07-23 01:23:09 -07:00
Peter Johnson
6f940bcaaf
Add immediate_notify and is_new to entry listener.
...
On the callback function, is_new indicates the value is newly added.
On adding a callback function, immediate_notify indicates the callback
should be called once (with is_new=true) for each matching entry that
already exists.
2015-07-23 01:02:53 -07:00