ntcore: Add support for local-only operation (#2204)

StartLocal() causes future calls to StartServer() or StartClient() to have
no effect. StopLocal() re-enables these calls.
This commit is contained in:
Peter Johnson
2019-12-29 14:56:41 -06:00
committed by GitHub
parent 44bcf7fb4d
commit 6ea13ea8f3
11 changed files with 123 additions and 5 deletions

View File

@@ -115,6 +115,16 @@ DispatcherBase::~DispatcherBase() { Stop(); }
unsigned int DispatcherBase::GetNetworkMode() const { return m_networkMode; }
void DispatcherBase::StartLocal() {
{
std::scoped_lock lock(m_user_mutex);
if (m_active) return;
m_active = true;
}
m_networkMode = NT_NET_MODE_LOCAL;
m_storage.SetDispatcher(this, false);
}
void DispatcherBase::StartServer(
const Twine& persist_filename,
std::unique_ptr<wpi::NetworkAcceptor> acceptor) {