From 4b4002115d6c7b5c5113d1e2e6e9025565e1c9bb Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 31 Aug 2015 20:45:06 +0300 Subject: protocol: download struct must have module_name field server: core: implemented SERVER_DOWNLOADS_LIST_REPLY (draft) added global downloads list client: using std::string instead of QString to avoid unnecessary conversions --- server/include/download_internal.h | 31 +++++++++++++++++++++++++++++++ server/include/modules_handler.h | 2 ++ server/include/server.h | 4 +++- server/include/server_session.h | 4 +++- 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 server/include/download_internal.h (limited to 'server/include') diff --git a/server/include/download_internal.h b/server/include/download_internal.h new file mode 100644 index 0000000..3474071 --- /dev/null +++ b/server/include/download_internal.h @@ -0,0 +1,31 @@ +/* + Copyright © 2015 Gluzskiy Alexandr (sss) + + This file is part of Unknown Download Manager (UDM). + + UDM 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 2 of the License, or + (at your option) any later version. + + UDM 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 UDM. If not, see . + +*/ + +#ifndef DOWNLOAD_INTERNAL_H +#define DOWNLOAD_INTERNAL_H + +struct download_internal_s +{ + int core_id, module_id; + std::string module_name; +}; + + +#endif diff --git a/server/include/modules_handler.h b/server/include/modules_handler.h index 5696053..7c8bc71 100644 --- a/server/include/modules_handler.h +++ b/server/include/modules_handler.h @@ -24,6 +24,7 @@ #include #include +#include "download_internal.h" #include class modules_handler @@ -32,6 +33,7 @@ class modules_handler modules_handler(); void load_modules(); void on_modules_loaded(); + void sync_downloads(std::map &downloads); std::string list_modules(); std::list &get_metadata_modules(); std::list &get_downloader_modules(); diff --git a/server/include/server.h b/server/include/server.h index 699fb01..046628a 100644 --- a/server/include/server.h +++ b/server/include/server.h @@ -26,6 +26,7 @@ #include #include "config.h" #include "client.h" +#include "download_internal.h" //TODO ssl @@ -35,7 +36,7 @@ class server_session; class server { public: - server(boost::asio::io_service& io_service, runtime_config_s &config, std::map &clients, short port); + server(boost::asio::io_service& io_service, runtime_config_s &config, std::map &clients, std::map &downloads, short port); private: void start_accept(); @@ -46,6 +47,7 @@ private: boost::asio::ssl::context *context_; runtime_config_s &runtime_config; std::map &clients; + std::map &downloads; }; diff --git a/server/include/server_session.h b/server/include/server_session.h index bad8f4f..01a8c4b 100644 --- a/server/include/server_session.h +++ b/server/include/server_session.h @@ -26,6 +26,7 @@ #include #include "config.h" #include "client.h" +#include "download_internal.h" class client_msg; class server_msg; @@ -34,7 +35,7 @@ class socket_wraper; class server_session { public: - server_session(boost::asio::io_service &s, runtime_config_s &config, std::map &clients_, boost::asio::ssl::context *c = nullptr); + server_session(boost::asio::io_service &s, runtime_config_s &config, std::map &clients_, std::map &downloads, boost::asio::ssl::context *c = nullptr); void run(); void send_message(server_msg *msg); socket_wraper* socket(); @@ -55,6 +56,7 @@ class server_session runtime_config_s &runtime_config; std::map &clients; client *client_; + std::map &downloads; //TODO: store client ptr }; -- cgit v1.2.3