From 4218bedd0125eec7fdc58c3817ef949bb9d935e0 Mon Sep 17 00:00:00 2001 From: badaix Date: Fri, 22 Jan 2016 22:16:07 +0100 Subject: [PATCH] removed command message --- client/controller.cpp | 5 ---- message/command.h | 62 ---------------------------------------- message/message.h | 2 +- server/controlServer.cpp | 1 - server/streamSession.cpp | 3 +- server/streamSession.h | 8 ------ 6 files changed, 2 insertions(+), 79 deletions(-) delete mode 100644 message/command.h diff --git a/client/controller.cpp b/client/controller.cpp index ee263e52..6fda5a73 100644 --- a/client/controller.cpp +++ b/client/controller.cpp @@ -32,7 +32,6 @@ #include "message/time.h" #include "message/request.h" #include "message/ack.h" -#include "message/command.h" #include "message/hello.h" using namespace std; @@ -191,10 +190,6 @@ void Controller::worker() player_->setMute(serverSettings->muted); player_->start(); - msg::Command startStream("startStream"); - shared_ptr ackMsg(NULL); - while (active_ && !(ackMsg = clientConnection_->sendReq(&startStream))); - while (active_) { for (size_t n=0; n<10 && active_; ++n) diff --git a/message/command.h b/message/command.h deleted file mode 100644 index 65abff4b..00000000 --- a/message/command.h +++ /dev/null @@ -1,62 +0,0 @@ -/*** - This file is part of snapcast - Copyright (C) 2014-2016 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -***/ - -#ifndef COMMAND_MSG_H -#define COMMAND_MSG_H - -#include "stringMessage.h" -#include - - -namespace msg -{ - -class Command : public StringMessage -{ -public: - Command() : StringMessage(message_type::kCommand) - { - } - - Command(const std::string& _command) : StringMessage(message_type::kCommand, _command) - { - } - - virtual ~Command() - { - } - - - const std::string& getCommand() const - { - return str; - } - - void setCommand(const std::string& command) - { - str = command; - } - -}; - -} - - -#endif - - diff --git a/message/message.h b/message/message.h index c8630738..7216f8dd 100644 --- a/message/message.h +++ b/message/message.h @@ -56,7 +56,7 @@ enum message_type kTime = 5, kRequest = 6, kAck = 7, - kCommand = 8, +// kCommand = 8, kHello = 9, kMap = 10, kString = 11 diff --git a/server/controlServer.cpp b/server/controlServer.cpp index afb1f46d..b4659109 100644 --- a/server/controlServer.cpp +++ b/server/controlServer.cpp @@ -20,7 +20,6 @@ #include "message/time.h" #include "message/ack.h" #include "message/request.h" -#include "message/command.h" #include "common/log.h" #include "common/utils.h" #include "common/snapException.h" diff --git a/server/streamSession.cpp b/server/streamSession.cpp index 31135769..90cb546a 100644 --- a/server/streamSession.cpp +++ b/server/streamSession.cpp @@ -42,7 +42,6 @@ StreamSession::~StreamSession() void StreamSession::start() { setActive(true); - streamActive_ = false; readerThread_ = new thread(&StreamSession::reader, this); writerThread_ = new thread(&StreamSession::writer, this); } @@ -99,7 +98,7 @@ void StreamSession::socketRead(void* _to, size_t _bytes) void StreamSession::add(const shared_ptr& message) { - if (!message || !streamActive_) + if (!message) return; while (messages_.size() > 100)// chunk->getDuration() > 10000) diff --git a/server/streamSession.h b/server/streamSession.h index 8e521b03..ba3123cd 100644 --- a/server/streamSession.h +++ b/server/streamSession.h @@ -72,13 +72,6 @@ public: return active_; } - /// Client subscribed for the PCM stream, by sending the "startStream" command - /// TODO: Currently there is only one stream ("zone") - void setStreamActive(bool active) - { - streamActive_ = active; - } - /// Max playout latency. No need to send PCM data that is older than bufferMs void setBufferMs(size_t bufferMs) { @@ -100,7 +93,6 @@ protected: void setActive(bool active); std::atomic active_; - std::atomic streamActive_; mutable std::mutex mutex_; std::thread* readerThread_; std::thread* writerThread_;