mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-04-06 02:01:58 +02:00
Fix pipe crash when SteamVR fails to boot (#887)
This commit is contained in:
@@ -5,6 +5,7 @@ import dev.slimevr.desktop.platform.ProtobufMessages.*;
|
||||
import dev.slimevr.config.BridgeConfig;
|
||||
import dev.slimevr.tracking.trackers.*;
|
||||
import dev.slimevr.util.ann.VRServerThread;
|
||||
import dev.slimevr.bridge.BridgeThread;
|
||||
import io.eiren.util.collections.FastList;
|
||||
import solarxr_protocol.rpc.StatusData;
|
||||
import solarxr_protocol.rpc.StatusDataUnion;
|
||||
@@ -383,11 +384,10 @@ public abstract class SteamVRBridge extends ProtobufBridge implements Runnable {
|
||||
*/
|
||||
protected int lastSteamVRStatus = 0;
|
||||
|
||||
@BridgeThread
|
||||
protected void reportDisconnected() {
|
||||
if (lastSteamVRStatus != 0) {
|
||||
throw new IllegalStateException(
|
||||
"lastSteamVRStatus wasn't 0 and it was " + lastSteamVRStatus + " instead"
|
||||
);
|
||||
return;
|
||||
}
|
||||
var statusData = new StatusSteamVRDisconnectedT();
|
||||
statusData.setBridgeSettingsName(bridgeSettingsKey);
|
||||
@@ -399,4 +399,14 @@ public abstract class SteamVRBridge extends ProtobufBridge implements Runnable {
|
||||
.addStatusInt(status, false);
|
||||
|
||||
}
|
||||
|
||||
@BridgeThread
|
||||
protected void reportConnected() {
|
||||
if (lastSteamVRStatus == 0) {
|
||||
return;
|
||||
}
|
||||
VRServer.Companion.getInstance().statusSystem
|
||||
.removeStatusInt(lastSteamVRStatus);
|
||||
lastSteamVRStatus = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,12 +82,10 @@ public class UnixSocketBridge extends SteamVRBridge implements AutoCloseable {
|
||||
try {
|
||||
boolean updated = this.updateSocket();
|
||||
updateMessageQueue();
|
||||
if (!updated) {
|
||||
if (updated) {
|
||||
reportConnected();
|
||||
} else {
|
||||
this.waitForData(10);
|
||||
} else if (lastSteamVRStatus != 0) {
|
||||
VRServer.Companion.getInstance().statusSystem
|
||||
.removeStatusInt(lastSteamVRStatus);
|
||||
lastSteamVRStatus = 0;
|
||||
}
|
||||
} catch (IOException ioError) {
|
||||
this.resetChannel();
|
||||
|
||||
@@ -79,10 +79,8 @@ public class WindowsNamedPipeBridge extends SteamVRBridge {
|
||||
}
|
||||
if (pipe.state == PipeState.OPEN) {
|
||||
pipesUpdated = updatePipe();
|
||||
if (lastSteamVRStatus != 0 && pipesUpdated) {
|
||||
VRServer.Companion.getInstance().statusSystem
|
||||
.removeStatusInt(lastSteamVRStatus);
|
||||
lastSteamVRStatus = 0;
|
||||
if (pipesUpdated) {
|
||||
reportConnected();
|
||||
}
|
||||
updateMessageQueue();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user