diff --git a/client/clientConnection.cpp b/client/clientConnection.cpp index fc28c63b..7c194172 100644 --- a/client/clientConnection.cpp +++ b/client/clientConnection.cpp @@ -43,12 +43,11 @@ void ClientConnection::socketRead(void* _to, size_t _bytes) 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(port_)); auto iterator = resolver.resolve(query); logO << "connecting\n"; - socket_.reset(new tcp::socket(io_service)); + socket_.reset(new tcp::socket(io_service_)); // struct timeval tv; // tv.tv_sec = 5; // tv.tv_usec = 0; @@ -74,9 +73,9 @@ void ClientConnection::stop() if (socket_) { 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); - if (ec) logE << "Error in socket close: " << ec << "\n"; + if (ec) logE << "Error in socket close: " << ec << endl; } if (readerThread_) { diff --git a/client/clientConnection.h b/client/clientConnection.h index d13f78a2..db5e6c42 100644 --- a/client/clientConnection.h +++ b/client/clientConnection.h @@ -75,6 +75,7 @@ protected: void socketRead(void* to, size_t bytes); void getNextMessage(); + boost::asio::io_service io_service_; std::shared_ptr socket_; std::atomic active_; std::atomic connected_; diff --git a/client/controller.cpp b/client/controller.cpp index 2534c28c..e66a04e2 100644 --- a/client/controller.cpp +++ b/client/controller.cpp @@ -62,7 +62,7 @@ void Controller::start(const PcmDevice& pcmDevice, const std::string& ip, size_t void Controller::stop() { - logD << "Stopping\n"; + logD << "Stopping Controller" << endl; active_ = false; controllerThread_->join(); clientConnection_->stop();