mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-02 10:51:45 +02:00
Use namespace "boost::asio" instead of "net"
This commit is contained in:
parent
989eb6ec8e
commit
4f29f000de
16 changed files with 79 additions and 74 deletions
|
@ -1,6 +1,6 @@
|
|||
/***
|
||||
This file is part of snapcast
|
||||
Copyright (C) 2014-2021 Johannes Pohl
|
||||
Copyright (C) 2014-2022 Johannes Pohl
|
||||
|
||||
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
|
||||
|
@ -45,7 +45,7 @@ static constexpr auto LOG_TAG = "PcmStream";
|
|||
|
||||
|
||||
PcmStream::PcmStream(PcmStream::Listener* pcmListener, boost::asio::io_context& ioc, const ServerSettings& server_settings, const StreamUri& uri)
|
||||
: active_(false), strand_(net::make_strand(ioc.get_executor())), pcmListeners_{pcmListener}, uri_(uri), chunk_ms_(20), state_(ReaderState::kIdle),
|
||||
: active_(false), strand_(boost::asio::make_strand(ioc.get_executor())), pcmListeners_{pcmListener}, uri_(uri), chunk_ms_(20), state_(ReaderState::kIdle),
|
||||
ioc_(ioc), server_settings_(server_settings), req_id_(0), property_timer_(strand_)
|
||||
{
|
||||
encoder::EncoderFactory encoderFactory;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/***
|
||||
This file is part of snapcast
|
||||
Copyright (C) 2014-2021 Johannes Pohl
|
||||
Copyright (C) 2014-2022 Johannes Pohl
|
||||
|
||||
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
|
||||
|
@ -39,7 +39,7 @@ namespace streamreader
|
|||
static constexpr auto LOG_TAG = "Script";
|
||||
|
||||
|
||||
StreamControl::StreamControl(const net::any_io_executor& executor) : executor_(executor)
|
||||
StreamControl::StreamControl(const boost::asio::any_io_executor& executor) : executor_(executor)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ void StreamControl::start(const std::string& stream_id, const ServerSettings& se
|
|||
void StreamControl::command(const jsonrpcpp::Request& request, const OnResponse& response_handler)
|
||||
{
|
||||
// use strand to serialize commands sent from different threads
|
||||
net::post(executor_, [this, request, response_handler]() {
|
||||
boost::asio::post(executor_, [this, request, response_handler]() {
|
||||
if (response_handler)
|
||||
request_callbacks_[request.id()] = response_handler;
|
||||
|
||||
|
@ -137,7 +137,7 @@ void StreamControl::onLog(std::string message)
|
|||
|
||||
|
||||
|
||||
ScriptStreamControl::ScriptStreamControl(const net::any_io_executor& executor, const std::string& script) : StreamControl(executor), script_(script)
|
||||
ScriptStreamControl::ScriptStreamControl(const boost::asio::any_io_executor& executor, const std::string& script) : StreamControl(executor), script_(script)
|
||||
{
|
||||
namespace fs = utils::file;
|
||||
if (!fs::exists(script_))
|
||||
|
@ -194,7 +194,7 @@ void ScriptStreamControl::doCommand(const jsonrpcpp::Request& request)
|
|||
void ScriptStreamControl::stderrReadLine()
|
||||
{
|
||||
const std::string delimiter = "\n";
|
||||
net::async_read_until(*stream_stderr_, streambuf_stderr_, delimiter, [this, delimiter](const std::error_code& ec, std::size_t bytes_transferred) {
|
||||
boost::asio::async_read_until(*stream_stderr_, streambuf_stderr_, delimiter, [this, delimiter](const std::error_code& ec, std::size_t bytes_transferred) {
|
||||
if (ec)
|
||||
{
|
||||
LOG(ERROR, LOG_TAG) << "Error while reading from stderr: " << ec.message() << "\n";
|
||||
|
@ -214,7 +214,7 @@ void ScriptStreamControl::stderrReadLine()
|
|||
void ScriptStreamControl::stdoutReadLine()
|
||||
{
|
||||
const std::string delimiter = "\n";
|
||||
net::async_read_until(*stream_stdout_, streambuf_stdout_, delimiter, [this, delimiter](const std::error_code& ec, std::size_t bytes_transferred) {
|
||||
boost::asio::async_read_until(*stream_stdout_, streambuf_stdout_, delimiter, [this, delimiter](const std::error_code& ec, std::size_t bytes_transferred) {
|
||||
if (ec)
|
||||
{
|
||||
LOG(ERROR, LOG_TAG) << "Error while reading from stdout: " << ec.message() << "\n";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/***
|
||||
This file is part of snapcast
|
||||
Copyright (C) 2014-2021 Johannes Pohl
|
||||
Copyright (C) 2014-2022 Johannes Pohl
|
||||
|
||||
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
|
||||
|
@ -58,7 +58,7 @@ public:
|
|||
using OnResponse = std::function<void(const jsonrpcpp::Response& response)>;
|
||||
using OnLog = std::function<void(std::string message)>;
|
||||
|
||||
StreamControl(const net::any_io_executor& executor);
|
||||
StreamControl(const boost::asio::any_io_executor& executor);
|
||||
virtual ~StreamControl();
|
||||
|
||||
void start(const std::string& stream_id, const ServerSettings& server_setttings, const OnNotification& notification_handler,
|
||||
|
@ -74,7 +74,7 @@ protected:
|
|||
void onReceive(const std::string& json);
|
||||
void onLog(std::string message);
|
||||
|
||||
net::any_io_executor executor_;
|
||||
boost::asio::any_io_executor executor_;
|
||||
|
||||
private:
|
||||
OnRequest request_handler_;
|
||||
|
@ -88,7 +88,7 @@ private:
|
|||
class ScriptStreamControl : public StreamControl
|
||||
{
|
||||
public:
|
||||
ScriptStreamControl(const net::any_io_executor& executor, const std::string& script);
|
||||
ScriptStreamControl(const boost::asio::any_io_executor& executor, const std::string& script);
|
||||
virtual ~ScriptStreamControl() = default;
|
||||
|
||||
void stop() override;
|
||||
|
|
|
@ -36,7 +36,7 @@ using namespace std;
|
|||
namespace streamreader
|
||||
{
|
||||
|
||||
Watchdog::Watchdog(const net::any_io_executor& executor, WatchdogListener* listener) : timer_(executor), listener_(listener)
|
||||
Watchdog::Watchdog(const boost::asio::any_io_executor& executor, WatchdogListener* listener) : timer_(executor), listener_(listener)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
class Watchdog
|
||||
{
|
||||
public:
|
||||
Watchdog(const net::any_io_executor& executor, WatchdogListener* listener = nullptr);
|
||||
Watchdog(const boost::asio::any_io_executor& executor, WatchdogListener* listener = nullptr);
|
||||
virtual ~Watchdog();
|
||||
|
||||
void start(const std::chrono::milliseconds& timeout);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue