[ntcore] Various NT4 fixes (#4474)

* TopicListener: Fix Add() return values
* Update PubSubOption poll storage documentation
* Update NetworkTableEntry::GetValue() doc
* Add documentation regarding asynchronous callbacks
* Unpublish entry: set publisher to nullptr
* Implement ValueListenerPoller default constructor
* Remove SetNetworkIdentity, make parameter to StartClient
* URI-escape client ID, improve error message
* Add connected message with client id; also improve disconnected message a bit
* Handle SetServers either before or after StartClient
* Fix client use-after-free; also delay reconnect after disconnect to rate limit
* Don't re-announce to already subscribed client; we especially don't want to send the last value again
* Always accept in-order sets, only use timestamp for tiebreak
* Fix LocalStorage::StartNetwork race
* Remove unused/unimplemented function

Also:
* [glass] Remove debug print
* [glass] Fix mpack string decoding
* [cameraserver] Fix up startclient
This commit is contained in:
Peter Johnson
2022-10-21 22:04:14 -07:00
committed by GitHub
parent 4a401b89d7
commit 10ed4b3969
47 changed files with 253 additions and 261 deletions

View File

@@ -8,6 +8,7 @@
#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include <wpi/mutex.h>
@@ -45,10 +46,11 @@ class InstanceImpl {
std::string_view listenAddress, unsigned int port3,
unsigned int port4);
void StopServer();
void StartClient3();
void StartClient4();
void StartClient3(std::string_view identity);
void StartClient4(std::string_view identity);
void StopClient();
void SetIdentity(std::string_view identity);
void SetServers(
std::span<const std::pair<std::string, unsigned int>> servers);
std::shared_ptr<NetworkServer> GetServer();
std::shared_ptr<INetworkClient> GetClient();
@@ -68,9 +70,9 @@ class InstanceImpl {
static wpi::mutex s_mutex;
wpi::mutex m_mutex;
std::string m_identity;
std::shared_ptr<NetworkServer> m_networkServer;
std::shared_ptr<INetworkClient> m_networkClient;
std::vector<std::pair<std::string, unsigned int>> m_servers;
int m_inst;
};