Fix linter warnings

This commit is contained in:
badaix 2025-02-12 22:06:02 +01:00 committed by Johannes Pohl
parent dc8c77c89a
commit f680c1486b
5 changed files with 8 additions and 6 deletions

View file

@ -1,6 +1,6 @@
/*** /***
This file is part of snapcast This file is part of snapcast
Copyright (C) 2014-2024 Johannes Pohl Copyright (C) 2014-2025 Johannes Pohl
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -51,7 +51,7 @@ public:
struct Volume struct Volume
{ {
double volume{1.0}; ///< volume [0..1] double volume{1.0}; ///< volume [0..1]
bool mute{false}; ///< muted? bool mute{false}; ///< muted?
}; };
using volume_callback = std::function<void(const Volume& volume)>; using volume_callback = std::function<void(const Volume& volume)>;

View file

@ -17,6 +17,7 @@ curl --header "Content-Type: application/json" --request POST --data '{"id":7,"j
``` ```
### Remove all disconnected clients ### Remove all disconnected clients
```bash ```bash
curl -s -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "Server.GetStatus"}' http://127.0.0.1:1780/jsonrpc | jq '.result.server.groups[].clients[] | select(.connected==false) .id' | while read ln; do curl -s -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "Server.DeleteClient", "params": {"id":'$ln'}}' http://127.0.0.1:1780/jsonrpc; done curl -s -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "Server.GetStatus"}' http://127.0.0.1:1780/jsonrpc | jq '.result.server.groups[].clients[] | select(.connected==false) .id' | while read ln; do curl -s -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "Server.DeleteClient", "params": {"id":'$ln'}}' http://127.0.0.1:1780/jsonrpc; done
``` ```

View file

@ -43,6 +43,7 @@ public:
struct Description struct Description
{ {
/// c'tor /// c'tor
// NOLINTNEXTLINE
Description(std::string description, std::vector<std::pair<std::string, std::string>> parameters = {}, std::string result = "") Description(std::string description, std::vector<std::pair<std::string, std::string>> parameters = {}, std::string result = "")
: description(std::move(description)), parameters(std::move(parameters)), result(std::move(result)) : description(std::move(description)), parameters(std::move(parameters)), result(std::move(result))
{ {

View file

@ -57,14 +57,14 @@ void StreamServer::cleanup()
} }
void StreamServer::addSession(const std::shared_ptr<StreamSession>& session) void StreamServer::addSession(std::shared_ptr<StreamSession> session)
{ {
session->setMessageReceiver(this); session->setMessageReceiver(this);
session->setBufferMs(settings_.stream.bufferMs); session->setBufferMs(settings_.stream.bufferMs);
session->start(); session->start();
std::lock_guard<std::recursive_mutex> mlock(sessionsMutex_); std::lock_guard<std::recursive_mutex> mlock(sessionsMutex_);
sessions_.emplace_back(session); sessions_.emplace_back(std::move(session));
cleanup(); cleanup();
} }
@ -210,7 +210,7 @@ void StreamServer::handleAccept(tcp::socket socket)
LOG(NOTICE, LOG_TAG) << "StreamServer::NewConnection: " << socket.remote_endpoint().address().to_string() << "\n"; LOG(NOTICE, LOG_TAG) << "StreamServer::NewConnection: " << socket.remote_endpoint().address().to_string() << "\n";
shared_ptr<StreamSession> session = make_shared<StreamSessionTcp>(this, settings_, std::move(socket)); shared_ptr<StreamSession> session = make_shared<StreamSessionTcp>(this, settings_, std::move(socket));
addSession(session); addSession(std::move(session));
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {

View file

@ -67,7 +67,7 @@ public:
// void send(const msg::BaseMessage* message); // void send(const msg::BaseMessage* message);
/// Add a new stream session /// Add a new stream session
void addSession(const std::shared_ptr<StreamSession>& session); void addSession(std::shared_ptr<StreamSession> session);
/// Callback for chunks that are ready to be sent /// Callback for chunks that are ready to be sent
void onChunkEncoded(const PcmStream* pcmStream, bool isDefaultStream, const std::shared_ptr<msg::PcmChunk>& chunk, double duration); void onChunkEncoded(const PcmStream* pcmStream, bool isDefaultStream, const std::shared_ptr<msg::PcmChunk>& chunk, double duration);