summaryrefslogtreecommitdiff
path: root/client-qt/udm-client-qt/udm_main.cpp
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2015-12-10 06:15:47 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2015-12-10 06:15:47 +0300
commit1a345f933f5b86fb297463863bd82334c94592c7 (patch)
tree3f6fed6d8d6f58c894d681ba8b37e8804c7cc2ee /client-qt/udm-client-qt/udm_main.cpp
parentba29462f09c748de5c75837f9fdd3c1bb3bc4791 (diff)
docs:
added BUGS file with known bugs server: fixed bug with download_deleted event optimized download state change event (send nothing on no subscriptions match) client-qt: implemented download deleted event handler
Diffstat (limited to 'client-qt/udm-client-qt/udm_main.cpp')
-rw-r--r--client-qt/udm-client-qt/udm_main.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/client-qt/udm-client-qt/udm_main.cpp b/client-qt/udm-client-qt/udm_main.cpp
index fcd07ff..48ff7c8 100644
--- a/client-qt/udm-client-qt/udm_main.cpp
+++ b/client-qt/udm-client-qt/udm_main.cpp
@@ -251,6 +251,7 @@ void udm_main::client_connect_ssl(QString &host, QString &password, int port, QS
void udm_main::server_message_received(server_msg msg)
{
+ BOOST_LOG_TRIVIAL(trace)<<"recieved server message\n"<<msg.DebugString();
switch(msg.type())
{
case SERVER_MSG_TYPE::SERVER_AUTH_REPLY:
@@ -303,6 +304,7 @@ void udm_main::server_message_received(server_msg msg)
s->set_module_name("");
s->mutable_download_state_change()->add_states(SDS_STARTED); //subscript to download started event
s->mutable_download_state_change()->add_states(SDS_STOPPED); //subscript to download stopped event
+ s->mutable_download_state_change()->add_states(SDS_DELETED); //subscript to download deleted event
session->send_message(msg);
}
@@ -373,10 +375,26 @@ void udm_main::server_message_received(server_msg msg)
//TODO:
break;
case SUBSCRIPTION_DOWNLOAD_STATE::SDS_DELETED:
+ {
+ bool found = false;
+ unsigned int pos = 0;
+ for(auto d = downloads.begin(), end = downloads.end(); d != end; ++d, ++pos)
+ {
+ if(d->id() == i.download_id())
+ {
+ found = true;
+ downloads.erase(d);
+ mdl_downloads->removeRows(pos, 1);
+ break;
+ }
+ if(!found)
+ BOOST_LOG_TRIVIAL(error)<<"error: deleted download which is not exist\n"<<msg.DebugString();
+ }
+ }
//TODO:
break;
default:
- BOOST_LOG_TRIVIAL(debug)<<"error: unhandled download state in server message message\n"<<msg.DebugString();
+ BOOST_LOG_TRIVIAL(error)<<"error: unhandled download state in server message message\n"<<msg.DebugString();
break;
}
}
@@ -384,7 +402,7 @@ void udm_main::server_message_received(server_msg msg)
}
break;
default:
- BOOST_LOG_TRIVIAL(debug)<<"error: unhandled server message\n"<<msg.DebugString();
+ BOOST_LOG_TRIVIAL(debug)<<"unhandled server message\n"<<msg.DebugString();
break;
}
}