Can NetworkStreamDriver.DriverStore please be made public?
I use this to iterate over connections to confirm Relay connection and to catch allocation errors, like this:
using var clientDriverQuery = client.EntityManager.CreateEntityQuery(ComponentType.ReadWrite<NetworkStreamDriver>());
// Wait for client to connect to relay.
while (true)
{
var streamDriver = clientDriverQuery.GetSingletonRW<NetworkStreamDriver>();
var lastDriverCount = streamDriver.ValueRO.DriverStore.LastDriver;
var established = false;
for (int i = NetworkDriverStore.FirstDriverId; i < lastDriverCount; i++)
{
var networkDriver = streamDriver.ValueRO.DriverStore.GetNetworkDriver(i);
var relayConnectionStatus = networkDriver.GetRelayConnectionStatus();
if (relayConnectionStatus == RelayConnectionStatus.AllocationInvalid)
{
BackWithError("Unable to connect to relay.");
return;
}
if (relayConnectionStatus == RelayConnectionStatus.Established)
{
established = true;
break;
}
}
if (established)
break;
await Task.Yield();
}
Thanks!