diff options
Diffstat (limited to 'server/src/server_session.cpp')
-rw-r--r-- | server/src/server_session.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/server/src/server_session.cpp b/server/src/server_session.cpp index 0d92341..b572980 100644 --- a/server/src/server_session.cpp +++ b/server/src/server_session.cpp @@ -644,19 +644,16 @@ void server_session::handle_write(const boost::system::error_code& error) // boost::asio::async_read(socket_, boost::asio::buffer(recv_data_, 4), boost::bind(&server_session::handle_read, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); } -bool operator==(event_subscription_base* const e, const SUBSCRIPTION_TYPE t) -{ - return *e == t; -} - void server_session::fire_event(SUBSCRIPTION_TYPE type, server_msg &msg) { for(auto i : clients) { - for(auto s = std::find(i.second->get_subscriptions().begin(), i.second->get_subscriptions().end(), type); s != i.second->get_subscriptions().end(); s = std::find(s, i.second->get_subscriptions().end(), type)) + for(auto s : i.second->get_subscriptions()) { - if((*s)->get_subtype() != EVENT_SUBTYPE::EVENT_SUBTYPE_EVENT) + if(s->get_subscription_request().type() != type) + continue; + if(s->get_subtype() != EVENT_SUBTYPE::EVENT_SUBTYPE_EVENT) continue; switch(type) { @@ -672,8 +669,8 @@ void server_session::fire_event(SUBSCRIPTION_TYPE type, server_msg &msg) filtered_message.set_type(msg.type()); for(auto sc : msg.download_state_changes()) { - auto dsc = std::find((*s)->get_subscription_request().download_state_change().states().begin(), (*s)->get_subscription_request().download_state_change().states().end(), sc.state()); - if(dsc != (*s)->get_subscription_request().download_state_change().states().end()) + auto dsc = std::find(s->get_subscription_request().download_state_change().states().begin(), s->get_subscription_request().download_state_change().states().end(), sc.state()); + if(dsc != s->get_subscription_request().download_state_change().states().end()) { auto sc2 = filtered_message.add_download_state_changes(); *sc2 = sc; |