mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-29 17:06:18 +02:00
stopping
git-svn-id: svn://elaine/murooma/trunk@342 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
b3336df0f2
commit
afc2c5baab
3 changed files with 6 additions and 6 deletions
|
@ -43,12 +43,11 @@ void ClientConnection::socketRead(void* _to, size_t _bytes)
|
||||||
|
|
||||||
void ClientConnection::start()
|
void ClientConnection::start()
|
||||||
{
|
{
|
||||||
boost::asio::io_service io_service;
|
tcp::resolver resolver(io_service_);
|
||||||
tcp::resolver resolver(io_service);
|
|
||||||
tcp::resolver::query query(tcp::v4(), ip_, boost::lexical_cast<string>(port_));
|
tcp::resolver::query query(tcp::v4(), ip_, boost::lexical_cast<string>(port_));
|
||||||
auto iterator = resolver.resolve(query);
|
auto iterator = resolver.resolve(query);
|
||||||
logO << "connecting\n";
|
logO << "connecting\n";
|
||||||
socket_.reset(new tcp::socket(io_service));
|
socket_.reset(new tcp::socket(io_service_));
|
||||||
// struct timeval tv;
|
// struct timeval tv;
|
||||||
// tv.tv_sec = 5;
|
// tv.tv_sec = 5;
|
||||||
// tv.tv_usec = 0;
|
// tv.tv_usec = 0;
|
||||||
|
@ -74,9 +73,9 @@ void ClientConnection::stop()
|
||||||
if (socket_)
|
if (socket_)
|
||||||
{
|
{
|
||||||
socket_->shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec);
|
socket_->shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec);
|
||||||
if (ec) logE << "Error in socket shutdown: " << ec << "\n";
|
if (ec) logE << "Error in socket shutdown: " << ec << endl;
|
||||||
socket_->close(ec);
|
socket_->close(ec);
|
||||||
if (ec) logE << "Error in socket close: " << ec << "\n";
|
if (ec) logE << "Error in socket close: " << ec << endl;
|
||||||
}
|
}
|
||||||
if (readerThread_)
|
if (readerThread_)
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,6 +75,7 @@ protected:
|
||||||
void socketRead(void* to, size_t bytes);
|
void socketRead(void* to, size_t bytes);
|
||||||
void getNextMessage();
|
void getNextMessage();
|
||||||
|
|
||||||
|
boost::asio::io_service io_service_;
|
||||||
std::shared_ptr<tcp::socket> socket_;
|
std::shared_ptr<tcp::socket> socket_;
|
||||||
std::atomic<bool> active_;
|
std::atomic<bool> active_;
|
||||||
std::atomic<bool> connected_;
|
std::atomic<bool> connected_;
|
||||||
|
|
|
@ -62,7 +62,7 @@ void Controller::start(const PcmDevice& pcmDevice, const std::string& ip, size_t
|
||||||
|
|
||||||
void Controller::stop()
|
void Controller::stop()
|
||||||
{
|
{
|
||||||
logD << "Stopping\n";
|
logD << "Stopping Controller" << endl;
|
||||||
active_ = false;
|
active_ = false;
|
||||||
controllerThread_->join();
|
controllerThread_->join();
|
||||||
clientConnection_->stop();
|
clientConnection_->stop();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue