Skip to content

Commit

Permalink
fix shutdown on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Vixea committed Dec 2, 2023
1 parent 5596cc5 commit a80f384
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion alvr/server/cpp/alvr_server/HMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Hmd::Hmd()
}

Hmd::~Hmd() {
ShutdownRuntime();
//ShutdownRuntime();

if (m_encoder) {
Debug("Hmd::~Hmd(): Stopping encoder...\n");
Expand Down
5 changes: 5 additions & 0 deletions alvr/server/cpp/alvr_server/alvr_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class DriverProvider : public vr::IServerTrackedDeviceProvider {
std::unique_ptr<Hmd> hmd;
std::unique_ptr<Controller> left_controller, right_controller;
// std::vector<ViveTrackerProxy> generic_trackers;
bool shutdown_called = false;

std::map<uint64_t, TrackedDevice *> tracked_devices;

Expand Down Expand Up @@ -149,6 +150,10 @@ class DriverProvider : public vr::IServerTrackedDeviceProvider {
}
#endif
}
if(vr::VRServerDriverHost()->IsExiting() && !shutdown_called) {
shutdown_called = true;
ShutdownRuntime();
}
}
virtual bool ShouldBlockStandbyMode() override { return false; }
virtual void EnterStandby() override {}
Expand Down
1 change: 1 addition & 0 deletions alvr/server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ pub extern "C" fn shutdown_driver() {
thread::sleep(Duration::from_millis(100));
}

#[cfg(target_os = "windows")]
WEBSERVER_RUNTIME.lock().take();

unsafe { ShutdownSteamvr() };
Expand Down

0 comments on commit a80f384

Please sign in to comment.