Peter Johnson
f031513470
[ntcore] NetworkTable::GetSubTables(): Remove duplicates ( #5076 )
...
In Java, a set is used. Use a two-stage approach in C++ to achieve the
same result.
2023-07-09 21:31:58 -07:00
Tyler Veness
5d3a133f9f
Remove spaces in NOLINT comments ( #5407 )
...
clang-tidy ignores the category filter if there's a space. wpiformat now
ignores categories it doesn't understand, so we can remove the spaces.
2023-06-20 20:29:23 -07:00
Tyler Veness
0eccc3f247
[ntcore] Fix clang-tidy warnings ( #5405 )
2023-06-20 08:21:44 -07:00
Tyler Veness
652d1c44e3
[wpiutil] Upgrade to macOS 12 to remove concept shims ( #5379 )
...
The macOS deployment target has been upgraded from 10.15 to 11. Also, a
deprecation warning for sprintf() in libuv was suppressed.
2023-06-08 19:59:54 -07:00
Tyler Veness
59905ea721
Replace WPI_DEPRECATED() macro with [[deprecated]] attribute ( #5373 )
...
Continue to use WPI_DEPRECATED macro for constructors until clang-format is fixed.
2023-06-08 00:01:06 -07:00
Ryan Blue
753cb49a5e
[ntcore] Fix doxygen module in generated C types (NFC) ( #5374 )
2023-06-07 09:56:20 -07:00
Tyler Veness
91cbcea841
Replace SFINAE with concepts ( #5361 )
...
Concepts are cleaner to use and result in much better error messages for incorrect template use.
2023-06-07 09:50:09 -07:00
Tyler Veness
5fac18ff4a
Update formatting to clang-format 16 ( #5370 )
2023-05-31 22:10:53 -07:00
Peter Johnson
2108a61362
[ntcore] NT4 client: close timed-out connections ( #5175 )
...
Pings are sent every 3 seconds. If we don't see a response to the last
ping before it's time to send the next one, close the connection.
2023-03-25 16:27:40 -07:00
Peter Johnson
0a66479693
[ntcore] Optimize scan of outgoing messages ( #5227 )
...
The algorithm being used for scanning outgoing messages was O(n^2)
because it did a full linear search and then appended. This scan is
performed for each client. If there is a burst of outgoing changes, the
outgoing queue can get quite deep all at once and this scan can be very
slow. Replacing with a map fixes this.
2023-03-25 15:20:22 -07:00
Peter Johnson
53b5fd2ace
[ntcore] Use int64 for datalog type string ( #5186 )
...
There's a spec difference between NT4 and datalog for integers; NT4 uses
"int", datalog uses "int64". We were using "int" for datalog as well.
Also add backwards compatibility support to datalogtool for treating
"int" as "int64".
2023-03-13 21:28:07 -07:00
sciencewhiz
4af84a1c12
Fix Typos (NFC) ( #5137 )
2023-02-26 15:06:37 -08:00
Peter Johnson
ecb072724d
[ntcore] Client::Disconnect(): actually close connection ( #5113 )
2023-02-17 23:56:49 -08:00
Peter Johnson
ba37986561
[ntcore] NetworkClient::Disconnect: Add null check ( #5112 )
2023-02-17 16:48:34 -08:00
Peter Johnson
9cc14bbb43
[ntcore] Add stress test to dev executable ( #5107 )
2023-02-16 22:49:36 -08:00
Peter Johnson
8068369542
[wpinet] uv: Stop creating handles when closing loop ( #5102 )
...
This prevents EventLoopRunner::Stop() from hanging in the case when
new handles are created after the async walk closes all the handles.
2023-02-16 22:49:14 -08:00
Peter Johnson
805c837a42
[ntcore] Fix use-after-free in server ( #5101 )
...
The client name deduplication didn't properly deduplicate. Instead,
always append the client index to guarantee a unique name.
2023-02-16 22:45:50 -08:00
Peter Johnson
843574a810
[ntcore] Use wpi::Now instead of loop time for transmit time
...
As the send function is called after local processing, there can be a
substantial delay between the loop time and the actual send.
2023-02-13 23:00:03 -08:00
Peter Johnson
b30664d630
[ntcore] Reduce initial connection overhead
...
Mixing the announce and value messages causes significant downstream
inefficiency in both time and space.
2023-02-13 23:00:03 -08:00
Peter Johnson
e57ded8c39
[ntcore] Improve disconnect error reporting ( #5085 )
...
Also fix memory leak in WebSocketConnection destructor.
2023-02-11 22:56:29 -08:00
Peter Johnson
19267bef0c
[ntcore] Output warning on property set on unpublished topic ( #5059 )
...
Previously this was a debug-level message. This can primarily impact
users who call SetPersistent() on an entry before calling SetDefault().
2023-02-05 11:57:29 -08:00
Peter Johnson
84cbd48d84
[ntcore] Handle excludeSelf on SetDefault ( #5058 )
2023-02-05 11:57:09 -08:00
Peter Johnson
49459d3e45
[ntcore] Change wire timeout to fixed 1 second ( #5048 )
...
Previously the timeout was 10 times the update rate, so with low update
rates it could be as small as 50 ms, causing spurious disconnects when
large or many topics were published.
2023-02-03 22:05:41 -08:00
Peter Johnson
b7535252c2
[ntcore] Don't leak buffers in rare WS shutdown case ( #5046 )
...
If the request called the callback after the WebSocket had been
destroyed, the buffers were leaked.
2023-02-03 21:56:35 -08:00
Peter Johnson
b61ac6db33
[ntcore] Add client disconnect function ( #5022 )
...
As setServer doesn't disconnect, it's useful to have a function that
disconnects without needing to completely stop the client.
2023-02-03 15:28:00 -08:00
Peter Johnson
1a47cc2e86
[ntcore] Use full handle when subscribing ( #5013 )
...
Just using the index is insufficient because of Subscriber overlap with
MultiSubscriber.
2023-01-27 09:14:38 -08:00
Peter Johnson
8785bba080
[ntcore] Special-case default timestamps ( #5003 )
...
Previously, a setDefault() on the server could override a client doing a
real set() if the time offset between client and server was negative,
resulting in a negative timestamp from the client. This is a not
uncommon situation with robot code, as the robot code always starts at
time 0, so any clients that set values earlier (in real time) would have
negative timestamps.
Also improve special casing of 0 in the transmit side to make sure a
normal timestamp will never get sent as 0.
2023-01-25 11:36:13 -08:00
Peter Johnson
9e5b7b8040
[ntcore] Handle topicsonly followed by value subscribe ( #4991 )
...
Previously this wouldn't send the last value on the value subscribe if a
topics only subscription already existed.
Also start adding server implementation unit tests.
2023-01-24 21:50:38 -08:00
Peter Johnson
008232b43c
[ntcore] Write empty persistent file if none found ( #4996 )
...
This avoids the warning appearing on every startup when persistent
values aren't used.
Also add note to message saying it can be ignored if persistent values
aren't expected.
2023-01-21 22:09:24 -08:00
Starlight220
bd6479dc29
[build] Add Spotless for JSON ( #4956 )
2023-01-16 08:26:46 -08:00
Peter Johnson
039edcc23f
[ntcore] Queue current value on subscriber creation ( #4938 )
...
This fixes a potential race condition in code that only uses readQueue.
2023-01-13 20:07:24 -08:00
Peter Johnson
aec6f3d506
[ntcore] Fix client flush behavior ( #4903 )
...
We need to ignore per-publisher send periods when flushing.
Also fix NT4 client to use flush async's (same as NT3 client).
2023-01-04 23:36:26 -08:00
Peter Johnson
1562eae74a
[ntcore] Refactor meta-topic decoding from glass ( #4809 )
2022-12-31 12:01:51 -08:00
Peter Johnson
f1151d375f
[ntcore] Add method to get server time offset ( #4847 )
...
Also exposes this as an event signaled when the offset is updated due to
a ping response from the server.
2022-12-30 20:15:57 -08:00
Peter Johnson
6cfe5de00d
[ntcore] Don't deadlock server on early destroy ( #4863 )
...
It was possible to deadlock on instance destroy if the server had started
but had not yet fully initialized its handles.
2022-12-27 10:25:48 -08:00
Sriman Achanta
26bdbf3d41
Java optimization and formatting fixes ( #4857 )
2022-12-26 11:37:53 -08:00
sciencewhiz
d20594db0d
Fix typos ( #4839 )
2022-12-21 08:53:00 -06:00
Peter Johnson
aae0f52ca6
[ntcore] NetworkTable: fix visibility of get/set value ( #4820 )
2022-12-14 19:43:53 -08:00
Peter Johnson
fb2c170b6e
[ntcore] Simplify local startup ( #4803 )
...
The current approach was slightly more efficient but didn't correctly
handle meta-topic publishing for topics published before the server was
started.
2022-12-13 22:31:44 -08:00
Peter Johnson
a865f48e96
[ntcore] Pass pub/sub options as a unified PubSubOptions struct ( #4794 )
...
In Java, PubSubOption is still used for passing options, but this
simplifies C++ use substantially, as it allows aggregate construction.
2022-12-12 19:28:15 -08:00
Peter Johnson
f8d4e9866e
[ntcore] Clean up ntcore_test.h ( #4804 )
...
The RPC functions are no longer implemented.
Also make header C-safe.
2022-12-12 15:36:54 -08:00
Peter Johnson
e6552d272e
[ntcore] Remove table multi-subscriber ( #4789 )
...
This wasn't well thought out, and leaks horribly in Java.
Reverts part of #4640 .
2022-12-09 21:25:29 -08:00
Peter Johnson
342c375a71
[ntcore] Add subscriber option to exclude single publisher
...
This enables limited self-exclusion for entries seeing their own changes
or similarly with a pub/sub pair.
2022-12-07 21:29:51 -08:00
Peter Johnson
b0e4053087
[ntcore] Use int for options instead of double
...
Periodic time is stored in milliseconds.
2022-12-07 21:29:51 -08:00
Peter Johnson
aa6499e920
[ntcore] Fix special topic multi-subscriber handling ( #4740 )
...
It now matches server behavior, where "" doesn't match special topics.
Also fixes duplicate notification that could occur in some cases.
2022-11-29 21:58:57 -08:00
Peter Johnson
9b319fd56b
[ntcore] Add sub option for local vs remote changes ( #4731 )
...
This is the subscriber readQueue version of the local value listener flag.
2022-11-29 21:57:20 -08:00
Peter Johnson
18d28ec5e3
[ntcore] Remove duplicate value checking from ClientImpl
...
This is no longer required with the duplicate value checking in
LocalStorage.
2022-11-29 09:49:47 -08:00
Peter Johnson
bdfb625211
[ntcore] Send duplicate values to network if necessary
...
Essentially this separates duplicate value detection between network and
local.
2022-11-29 09:49:47 -08:00
Tyler Veness
42b6d4e3f7
Use defaulted comparison operators in C++ ( #4723 )
...
Comparison operators which compared against every class member variable
now use C++20's default comparison operators.
Also remove operator!= that in C++20 is now auto-generated from operator==.
2022-11-27 21:01:01 -08:00
Peter Johnson
ffbfc61532
[ntcore] Add NetworkTable table-specific listeners ( #4640 )
...
These are similar, but not quite identical to, the NT3 NetworkTable
table listeners.
Also add table topic-only multi-subscriber to ensure functions like
getKeys() work properly regardless of other subscriptions.
2022-11-27 19:46:34 -08:00