mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-22 21:46:15 +02:00
Client uses less memory allocations
This commit is contained in:
parent
6999391f43
commit
e9a5a36855
7 changed files with 135 additions and 44 deletions
|
@ -215,10 +215,16 @@ int main(int argc, char** argv)
|
|||
#endif
|
||||
|
||||
bool active = true;
|
||||
std::shared_ptr<Controller> controller;
|
||||
auto signal_handler = install_signal_handler({SIGHUP, SIGTERM, SIGINT},
|
||||
[&active](int signal, const std::string& strsignal) {
|
||||
[&active, &controller](int signal, const std::string& strsignal) {
|
||||
SLOG(INFO) << "Received signal " << signal << ": " << strsignal << "\n";
|
||||
active = false;
|
||||
if (controller)
|
||||
{
|
||||
LOG(INFO) << "Stopping controller\n";
|
||||
controller->stop();
|
||||
}
|
||||
});
|
||||
if (host.empty())
|
||||
{
|
||||
|
@ -258,11 +264,11 @@ int main(int argc, char** argv)
|
|||
if (metaStderr)
|
||||
meta.reset(new MetaStderrAdapter);
|
||||
|
||||
std::unique_ptr<Controller> controller(new Controller(hostIdValue->value(), instance, meta));
|
||||
controller = make_shared<Controller>(hostIdValue->value(), instance, meta);
|
||||
LOG(INFO) << "Latency: " << latency << "\n";
|
||||
controller->start(pcmDevice, host, port, latency);
|
||||
signal_handler.wait();
|
||||
controller->stop();
|
||||
controller->run(pcmDevice, host, port, latency);
|
||||
// signal_handler.wait();
|
||||
// controller->stop();
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue