------------------------------------------------------------ revno: 35 committer: poy <p...@123gen.com> branch nick: DescriptionRotator timestamp: Thu 2013-06-13 23:53:03 +0200 message: safer calls from the timer modified: src/Plugin.cpp src/Plugin.h
-- lp:~dcplusplus-team/dcpp-plugin-sdk-cpp/DescriptionRotator https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/DescriptionRotator Your team Dcplusplus-team is subscribed to branch lp:~dcplusplus-team/dcpp-plugin-sdk-cpp/DescriptionRotator. To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/DescriptionRotator/+edit-subscription
=== modified file 'src/Plugin.cpp' --- src/Plugin.cpp 2013-06-08 13:36:29 +0000 +++ src/Plugin.cpp 2013-06-13 21:53:03 +0000 @@ -152,7 +152,7 @@ hub.second.next = 0; auto description = send ? hub.second.description : string(); - if(!hub.second.sid && !hub.second.description.empty()) { + if(!hub.second.sid && !description.empty()) { auto pos = nmdcDescr(description); if(pos.first) { description = description.substr(pos.first, pos.second - pos.first); @@ -171,10 +171,13 @@ hub.second.next += tick; if(send) { + auto data = Hubs::handle()->find_hub(hub.first.c_str()); + if(!data) { continue; } + hub.second.sending = true; if(hub.second.sid) { - Hubs::handle()->send_protocol_cmd(hub.second.hub, + Hubs::handle()->send_protocol_cmd(data, AdcCommand(AdcCommand::CMD_INF, AdcCommand::TYPE_BROADCAST) .addParam("DE", description) .toString(hub.second.sid).c_str()); @@ -185,7 +188,7 @@ if(pos.first) { cmd.erase(pos.first, pos.second - pos.first); cmd.insert(pos.first, description); - Hubs::handle()->send_protocol_cmd(hub.second.hub, cmd.c_str()); + Hubs::handle()->send_protocol_cmd(data, cmd.c_str()); } } @@ -235,7 +238,6 @@ Lock lock(mutex); auto& info = hubs[hub->url]; - info.hub = hub; info.sid = cmd.getFrom(); info.description = initial_desc; info.next = 0; @@ -266,7 +268,6 @@ Lock lock(mutex); auto& info = hubs[hub->url]; - info.hub = hub; info.sid = 0; info.description = cmd; info.next = 0; === modified file 'src/Plugin.h' --- src/Plugin.h 2013-06-08 12:24:29 +0000 +++ src/Plugin.h 2013-06-13 21:53:03 +0000 @@ -62,7 +62,6 @@ vector<Rule> rules; struct HubInfo { - HubDataPtr hub; bool sending; uint32_t sid; string description;
_______________________________________________ Mailing list: https://launchpad.net/~linuxdcpp-team Post to : linuxdcpp-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~linuxdcpp-team More help : https://help.launchpad.net/ListHelp