MCPcopy Create free account
hub / github.com/ClassicOldSong/Apollo / cancel

Function cancel

src/nvhttp.cpp:1459–1493  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1457 }
1458
1459 void cancel(resp_https_t response, req_https_t request) {
1460 print_req<SunshineHTTPS>(request);
1461
1462 pt::ptree tree;
1463 auto g = util::fail_guard([&]() {
1464 std::ostringstream data;
1465
1466 pt::write_xml(data, tree);
1467 response->write(data.str());
1468 response->close_connection_after_response = true;
1469 });
1470
1471 auto named_cert_p = get_verified_cert(request);
1472 if (!(named_cert_p->perm & PERM::launch)) {
1473 BOOST_LOG(debug) << "Permission CancelApp denied for [" << named_cert_p->name << "] (" << (uint32_t)named_cert_p->perm << ")";
1474
1475 tree.put("root.resume", 0);
1476 tree.put("root.<xmlattr>.status_code", 403);
1477 tree.put("root.<xmlattr>.status_message", "Permission denied");
1478
1479 return;
1480 }
1481
1482 tree.put("root.cancel", 1);
1483 tree.put("root.<xmlattr>.status_code", 200);
1484
1485 rtsp_stream::terminate_sessions();
1486
1487 if (proc::proc.running() > 0) {
1488 proc::proc.terminate();
1489 }
1490
1491 // The config needs to be reverted regardless of whether "proc::proc.terminate()" was called or not.
1492 display_device::revert_configuration();
1493 }
1494
1495 void appasset(resp_https_t response, req_https_t request) {
1496 print_req<SunshineHTTPS>(request);

Callers

nothing calls this directly

Calls 7

fail_guardFunction · 0.85
get_verified_certFunction · 0.85
terminate_sessionsFunction · 0.85
revert_configurationFunction · 0.85
writeMethod · 0.80
terminateMethod · 0.80
runningMethod · 0.45

Tested by

no test coverage detected