From 3f4214227e993305bb320b299245f466b9b22233 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 7 Mar 2015 17:19:31 +0100 Subject: Merge Stats and Config server, config is also JSON --- src/ConfigServer.h | 120 ----------------------------------------------------- 1 file changed, 120 deletions(-) delete mode 100644 src/ConfigServer.h (limited to 'src/ConfigServer.h') diff --git a/src/ConfigServer.h b/src/ConfigServer.h deleted file mode 100644 index b51ef32..0000000 --- a/src/ConfigServer.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, - 2011, 2012 Her Majesty the Queen in Right of Canada (Communications - Research Center Canada) - - Copyright (C) 2014 - Matthias P. Braendli, matthias.braendli@mpb.li - */ -/* - This file is part of ODR-DabMux. - - ODR-DabMux 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. - - ODR-DabMux 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 ODR-DabMux. If not, see . -*/ - -#ifndef __CONFIG_SERVER_H_ -#define __CONFIG_SERVER_H_ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class ConfigServer -{ - public: - ConfigServer() : - m_listenport(0), - m_running(false), - m_fault(false) - { } - - ConfigServer(int listen_port) : - m_listenport(listen_port), - m_running(false), - m_fault(false), - m_thread(&ConfigServer::serverThread, this) - { - m_sock = 0; - } - - ~ConfigServer() - { - m_running = false; - m_fault = false; - if (m_sock) { - close(m_sock); - } - m_thread.join(); - } - - bool request_pending() { - return m_pending; - } - - void update_ptree(const boost::property_tree::ptree& pt) { - boost::unique_lock lock(m_mutex); - m_pt = pt; - m_pending = false; - - m_condition.notify_one(); - } - - bool fault_detected() { return m_fault; } - void restart(void); - - private: - void restart_thread(long); - - /******* TCP Socket Server ******/ - // no copying (because of the thread) - ConfigServer(const ConfigServer& other); - - void serverThread(void); - - int m_listenport; - - // serverThread runs in a separate thread - bool m_running; - bool m_fault; - boost::thread m_thread; - boost::thread m_restarter_thread; - - int m_sock; - - bool m_pending; - std::string m_pending_request; - boost::condition_variable m_condition; - boost::mutex m_mutex; - - boost::property_tree::ptree m_pt; -}; - - -#endif - -- cgit v1.2.3