summaryrefslogtreecommitdiff
path: root/server/src/server_session.cpp
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2016-01-16 09:01:18 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2016-01-16 09:01:18 +0300
commitbb8cd8a9ff7d80046cc2c7d41742c74d8f811c62 (patch)
tree9353ecb0293fd89b8d08d893332ca7e912c3efa3 /server/src/server_session.cpp
parent454ed688836c9de52039b84ea381ffd22890a6e8 (diff)
i am alive )
updated copyrights (new year) server: started implementation of api for module events (module should be able to fire event which will be delivered to clients which have subscribed for this event type)
Diffstat (limited to 'server/src/server_session.cpp')
-rw-r--r--server/src/server_session.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/server/src/server_session.cpp b/server/src/server_session.cpp
index a79d5b6..5a15e5b 100644
--- a/server/src/server_session.cpp
+++ b/server/src/server_session.cpp
@@ -1,5 +1,5 @@
/*
- Copyright © 2015 Gluzskiy Alexandr (sss)
+ Copyright © 2015-2016 Gluzskiy Alexandr (sss)
This file is part of Unknown Download Manager (UDM).
@@ -271,6 +271,7 @@ void add_download_content_menu_element(module_download_menu_element_info_s &elem
bool server_session::handle_command(client_msg *msg)
{
+ //TODO: thread safety ?
if(msg->type() != CLIENT_MSG_TYPE::CLIENT_AUTH_REQUEST && clients.find(msg->auth_token()) == clients.end())
{
BOOST_LOG_TRIVIAL(error)<<"unauthorized client trying to execute command";
@@ -631,6 +632,7 @@ void server_session::send_download_list()
void server_session::send_message(server_msg *msg)
{
+ //TODO: thread safety
int size = 0;
std::shared_ptr<char*> ptr = pack_msg(msg, &size);
boost::asio::async_write(*socket_, boost::asio::buffer(*ptr, size), boost::bind(&server_session::handle_write, this, boost::asio::placeholders::error));
@@ -653,6 +655,7 @@ void server_session::handle_write(const boost::system::error_code& error)
void server_session::fire_event(SUBSCRIPTION_TYPE type, server_msg &msg)
{
+ //TODO: thread safety
for(auto i : clients)
{
for(auto s : i.second->get_subscriptions())