mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-02-22 12:40:11 +00:00
If all content has been read in RTSP request, no need for waiting for next message
This commit is contained in:
parent
b346ac2eb0
commit
21b1a4a336
@ -189,10 +189,12 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
task_pool.start(1);
|
||||
|
||||
bool shutdown_by_interrupt = false;
|
||||
|
||||
util::TaskPool::task_id_t force_shutdown = nullptr;
|
||||
// Create signal handler after logging has been initialized
|
||||
auto shutdown_event = mail::man->event<bool>(mail::shutdown);
|
||||
on_signal(SIGINT, [&force_shutdown, shutdown_event]() {
|
||||
on_signal(SIGINT, [&shutdown_by_interrupt, &force_shutdown, shutdown_event]() {
|
||||
BOOST_LOG(info) << "Interrupt handler called"sv;
|
||||
|
||||
auto task = []() {
|
||||
@ -202,7 +204,7 @@ int main(int argc, char *argv[]) {
|
||||
};
|
||||
force_shutdown = task_pool.pushDelayed(task, 10s).task_id;
|
||||
|
||||
|
||||
shutdown_by_interrupt = true;
|
||||
shutdown_event->raise(true);
|
||||
});
|
||||
|
||||
@ -219,7 +221,11 @@ int main(int argc, char *argv[]) {
|
||||
shutdown_event->raise(true);
|
||||
});
|
||||
|
||||
auto exit_guard = util::fail_guard([&force_shutdown]() {
|
||||
auto exit_guard = util::fail_guard([&shutdown_by_interrupt, &force_shutdown]() {
|
||||
if(!shutdown_by_interrupt) {
|
||||
return;
|
||||
}
|
||||
|
||||
task_pool.cancel(force_shutdown);
|
||||
|
||||
std::cout << "Sunshine exited: Press enter to continue"sv << std::endl;
|
||||
|
@ -87,6 +87,13 @@ public:
|
||||
if("Content-length"sv == option->option) {
|
||||
BOOST_LOG(debug) << "Found Content-Length: "sv << option->content << " bytes"sv;
|
||||
|
||||
// If content_length > bytes read, then we need to store current data read,
|
||||
// to be appended by the next read.
|
||||
auto content_length = util::from_view(option->content);
|
||||
if(content_length <= bytes) {
|
||||
break;
|
||||
}
|
||||
|
||||
auto incomplete_size = incomplete.size();
|
||||
incomplete.resize(incomplete.size() + bytes);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user