ignore network errors instead of crashing
wrap some code paths which could cause uncaught exceptions if called from one of the monado owned threads.
This commit is contained in:
@@ -43,8 +43,15 @@ void wivrn::tracking_control::add_request(device_id device, XrTime now, XrTime a
|
|||||||
|
|
||||||
if (not std::ranges::contains(last_control.pattern, device, &to_headset::tracking_control::sample::device))
|
if (not std::ranges::contains(last_control.pattern, device, &to_headset::tracking_control::sample::device))
|
||||||
{
|
{
|
||||||
last_control.pattern.push_back({.device = device, .prediction_ns = prediction});
|
try
|
||||||
cnx.send_control(to_headset::tracking_control(last_control));
|
{
|
||||||
|
cnx.send_control(to_headset::tracking_control(last_control));
|
||||||
|
last_control.pattern.push_back({.device = device, .prediction_ns = prediction});
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
// ignore network errors
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -785,7 +785,15 @@ static xrt_result_t comp_wivrn_request_refresh_rate(struct comp_target * ct, flo
|
|||||||
if (refresh_rate_hz == 0.0f)
|
if (refresh_rate_hz == 0.0f)
|
||||||
refresh_rate_hz = get_default_rate(cn->cnx.get_info(), *cn->cnx.get_settings());
|
refresh_rate_hz = get_default_rate(cn->cnx.get_info(), *cn->cnx.get_settings());
|
||||||
|
|
||||||
cn->cnx.send_control(to_headset::refresh_rate_change{.fps = refresh_rate_hz});
|
try
|
||||||
|
{
|
||||||
|
cn->cnx.send_control(to_headset::refresh_rate_change{.fps = refresh_rate_hz});
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
// ignore network errors
|
||||||
|
}
|
||||||
|
|
||||||
return XRT_SUCCESS;
|
return XRT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1018,8 +1018,15 @@ void wivrn_session::run_net(std::stop_token stop)
|
|||||||
if (stop.stop_requested())
|
if (stop.stop_requested())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
resume_session();
|
try
|
||||||
U_LOG_I("Headset connected, Session resumed.");
|
{
|
||||||
|
resume_session();
|
||||||
|
U_LOG_I("Headset connected, Session resumed.");
|
||||||
|
}
|
||||||
|
catch (const std::exception & e)
|
||||||
|
{
|
||||||
|
U_LOG_E("Exception on session resume: %s", e.what());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user