[ntcore] Always show StartLocal instances as connected (#2462)

This is useful for testing things that check IsConnected().
This commit is contained in:
Thad House
2020-04-02 17:58:07 -07:00
committed by GitHub
parent 306720e63e
commit 2b188b54d8

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2015-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2015-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -244,6 +244,8 @@ std::vector<ConnectionInfo> DispatcherBase::GetConnections() const {
bool DispatcherBase::IsConnected() const {
if (!m_active) return false;
if (m_networkMode == NT_NET_MODE_LOCAL) return true;
std::scoped_lock lock(m_user_mutex);
for (auto& conn : m_connections) {
if (conn->state() == NetworkConnection::kActive) return true;