Fix error 104 in Moonlight when starting Steam Bigpicture
This commit is contained in:
@@ -94,7 +94,7 @@ int proc_t::execute(int app_id) {
|
|||||||
|
|
||||||
for(auto &cmd : proc.detached) {
|
for(auto &cmd : proc.detached) {
|
||||||
BOOST_LOG(info) << "Spawning ["sv << cmd << ']';
|
BOOST_LOG(info) << "Spawning ["sv << cmd << ']';
|
||||||
if(proc.output.empty()) {
|
if(proc.output.empty() || proc.output == "null"sv) {
|
||||||
bp::spawn(cmd, _env, bp::std_out > bp::null, bp::std_err > bp::null, ec);
|
bp::spawn(cmd, _env, bp::std_out > bp::null, bp::std_err > bp::null, ec);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -106,14 +106,16 @@ int proc_t::execute(int app_id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_LOG(info) << "Executing: ["sv << proc.cmd << ']';
|
|
||||||
if(proc.cmd.empty()) {
|
if(proc.cmd.empty()) {
|
||||||
|
BOOST_LOG(debug) << "Executing [Desktop]"sv;
|
||||||
placebo = true;
|
placebo = true;
|
||||||
}
|
}
|
||||||
else if(proc.output.empty() || proc.output == "null"sv) {
|
else if(proc.output.empty() || proc.output == "null"sv) {
|
||||||
|
BOOST_LOG(info) << "Executing: ["sv << proc.cmd << ']';
|
||||||
_process = bp::child(_process_handle, proc.cmd, _env, bp::std_out > bp::null, bp::std_err > bp::null, ec);
|
_process = bp::child(_process_handle, proc.cmd, _env, bp::std_out > bp::null, bp::std_err > bp::null, ec);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
BOOST_LOG(info) << "Executing: ["sv << proc.cmd << ']';
|
||||||
_process = bp::child(_process_handle, proc.cmd, _env, bp::std_out > _pipe.get(), bp::std_err > _pipe.get(), ec);
|
_process = bp::child(_process_handle, proc.cmd, _env, bp::std_out > _pipe.get(), bp::std_err > _pipe.get(), ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+20
-2
@@ -261,6 +261,8 @@ public:
|
|||||||
else {
|
else {
|
||||||
cmd_not_found(sock, std::move(req));
|
cmd_not_found(sock, std::move(req));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sock.shutdown(boost::asio::socket_base::shutdown_type::shutdown_both);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_accept(const boost::system::error_code &ec) {
|
void handle_accept(const boost::system::error_code &ec) {
|
||||||
@@ -289,7 +291,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void session_raise(launch_session_t launch_session) {
|
void session_raise(launch_session_t launch_session) {
|
||||||
//FIXME: If client abandons us at this stage, _slot_count won't be raised again.
|
auto now = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
|
// If a launch event is still pending, don't overwrite it.
|
||||||
|
if(raised_timeout > now && launch_event.peek()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
raised_timeout = now + 10s;
|
||||||
|
|
||||||
--_slot_count;
|
--_slot_count;
|
||||||
launch_event.raise(launch_session);
|
launch_event.raise(launch_session);
|
||||||
}
|
}
|
||||||
@@ -301,6 +310,14 @@ public:
|
|||||||
safe::event_t<launch_session_t> launch_event;
|
safe::event_t<launch_session_t> launch_event;
|
||||||
|
|
||||||
void clear(bool all = true) {
|
void clear(bool all = true) {
|
||||||
|
// if a launch event timed out --> Remove it.
|
||||||
|
if(raised_timeout < std::chrono::steady_clock::now()) {
|
||||||
|
auto discarded = launch_event.pop(0s);
|
||||||
|
if(discarded) {
|
||||||
|
++_slot_count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto lg = _session_slots.lock();
|
auto lg = _session_slots.lock();
|
||||||
|
|
||||||
for(auto &slot : *_session_slots) {
|
for(auto &slot : *_session_slots) {
|
||||||
@@ -345,6 +362,7 @@ private:
|
|||||||
|
|
||||||
util::sync_t<std::vector<std::shared_ptr<session_t>>> _session_slots;
|
util::sync_t<std::vector<std::shared_ptr<session_t>>> _session_slots;
|
||||||
|
|
||||||
|
std::chrono::steady_clock::time_point raised_timeout;
|
||||||
int _slot_count;
|
int _slot_count;
|
||||||
|
|
||||||
boost::asio::io_service ios;
|
boost::asio::io_service ios;
|
||||||
@@ -353,7 +371,7 @@ private:
|
|||||||
std::shared_ptr<socket_t> next_socket;
|
std::shared_ptr<socket_t> next_socket;
|
||||||
};
|
};
|
||||||
|
|
||||||
rtsp_server_t server;
|
rtsp_server_t server {};
|
||||||
|
|
||||||
void launch_session_raise(launch_session_t launch_session) {
|
void launch_session_raise(launch_session_t launch_session) {
|
||||||
server.session_raise(launch_session);
|
server.session_raise(launch_session);
|
||||||
|
|||||||
Reference in New Issue
Block a user