diff --git a/client/doubleBuffer.h b/client/doubleBuffer.h index 954651cd..edaf722f 100644 --- a/client/doubleBuffer.h +++ b/client/doubleBuffer.h @@ -22,6 +22,12 @@ #include #include + +/// Size limited queue +/** + * Size limited queue with basic statistic functions: + * median, mean, percentile + */ template class DoubleBuffer { @@ -37,6 +43,7 @@ public: buffer.pop_front(); } + /// Median as mean over N values around the median T median(unsigned int mean = 1) const { if (buffer.empty()) diff --git a/server/controlServer.cpp b/server/controlServer.cpp index 622d7699..04859719 100644 --- a/server/controlServer.cpp +++ b/server/controlServer.cpp @@ -120,30 +120,14 @@ void ControlServer::start() { acceptor_ = make_shared(*io_service_, tcp::endpoint(tcp::v4(), port_)); startAccept(); -// acceptThread_ = thread(&ControlServer::acceptor, this); } void ControlServer::stop() { acceptor_->cancel(); -// io_service_.stop(); -/* try - { - acceptThread_.join(); - } - catch(const exception& e) - { - logO << "ControlServer::stop exception: " << e.what() << "\n"; - } -*/ std::unique_lock mlock(mutex_); + std::unique_lock mlock(mutex_); for (auto it = sessions_.begin(); it != sessions_.end(); ++it) (*it)->stop(); } - -//void ControlServer::acceptor() -//{ -// io_service_.run(); -//} - diff --git a/server/controlSession.h b/server/controlSession.h index 951460e3..6665f590 100644 --- a/server/controlSession.h +++ b/server/controlSession.h @@ -45,11 +45,11 @@ public: }; -/// Endpoint for a connected client. +/// Endpoint for a connected control client. /** - * Endpoint for a connected client. + * Endpoint for a connected control client. * Messages are sent to the client with the "send" method. - * Received messages from the client are passed to the MessageReceiver callback + * Received messages from the client are passed to the ControlMessageReceiver callback */ class ControlSession { diff --git a/server/json/snapserver.json b/server/json/snapserver.json deleted file mode 100644 index 678e24de..00000000 --- a/server/json/snapserver.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "Zone": - [ - { - "uri": "file:///tmp/SnapCast/snapfifo", - "name": "zone 1" - }, - { - "uri": "file:///tmp/SnapCast/snapfifo2", - "name": "zone 2" - } - ], - - "Client": - [ - { - "MAC": "00:21:6a:7d:74:fc", - "IP": "10.1.2.3", - "host": "T400", - "version": "1.2", - "name": "living room", - "volume": - { - "percent": 90, - "muted": true - }, - "lastSeen": - { - "sec": 99, - "usec": 1 - }, - "conntected": true, - "zone": "file:///tmp/SnapCast/snapfifo", - "latency": 0 - }, - { - "MAC": "11:21:6a:7d:74:fc", - "IP": "10.1.2.3", - "host": "T400", - "version": "1.2", - "name": "kitchen", - "volume": 0.9, - "lastSeen": - { - "sec": 99, - "usec": 1 - }, - "status": 0, - "zone": "file:///tmp/SnapCast/snapfifo", - "latency": 0 - } - ] -} diff --git a/server/snapServer.cpp b/server/snapServer.cpp index e790bed8..7498e7b7 100644 --- a/server/snapServer.cpp +++ b/server/snapServer.cpp @@ -54,7 +54,6 @@ int main(int argc, char* argv[]) po::options_description desc("Allowed options"); desc.add_options() ("help,h", "produce help message") - ("test", "for testing") ("version,v", "show version number") ("port,p", po::value(&settings.port)->default_value(settings.port), "server port") ("controlPort", po::value(&settings.controlPort)->default_value(settings.controlPort), "Remote control port") @@ -70,12 +69,6 @@ int main(int argc, char* argv[]) po::store(po::parse_command_line(argc, argv, desc), vm); po::notify(vm); - if (vm.count("test")) - { - Config::instance().test(); - return 1; - } - if (vm.count("help")) { cout << desc << "\n";