| 203 | } |
| 204 | |
| 205 | void plugins_manager::remove_plugins(const set <string> &dll_names) { |
| 206 | plugins_root *new_root = new plugins_root(); |
| 207 | plugins_root *old_root = NULL; |
| 208 | vector<plugin_handler *> vec_handler_will_delete; |
| 209 | tbsys::CThreadGuard guarder(&mutex); |
| 210 | if (root != NULL) { |
| 211 | (*new_root) = (*root); |
| 212 | } |
| 213 | for (set<string>::const_iterator dll_name_it = dll_names.begin(); |
| 214 | dll_name_it != dll_names.end(); dll_name_it++) { |
| 215 | int property_will_delete = -1; |
| 216 | map<int, plugin_handler *>::iterator it; |
| 217 | for (it = new_root->request_plugins.begin(); it != new_root->request_plugins.end(); it++) { |
| 218 | if (it->second->get_dll_name() == *dll_name_it) { |
| 219 | property_will_delete = it->first; |
| 220 | vec_handler_will_delete.push_back(it->second); |
| 221 | break; |
| 222 | } |
| 223 | } |
| 224 | if (property_will_delete == -1) { |
| 225 | for (it = new_root->response_plugins.begin(); it != new_root->response_plugins.end(); it++) { |
| 226 | if (it->second->get_dll_name() == *dll_name_it) { |
| 227 | property_will_delete = it->first; |
| 228 | vec_handler_will_delete.push_back(it->second); |
| 229 | break; |
| 230 | } |
| 231 | } |
| 232 | if (property_will_delete == -1) { |
| 233 | //delete new_root; |
| 234 | continue; |
| 235 | } |
| 236 | } |
| 237 | new_root->request_plugins.erase(property_will_delete); |
| 238 | new_root->response_plugins.erase(property_will_delete); |
| 239 | } |
| 240 | old_root = root; |
| 241 | root = new_root; |
| 242 | |
| 243 | usleep(WAIT_SECONDS); |
| 244 | for (vector<plugin_handler *>::iterator it = vec_handler_will_delete.begin(); |
| 245 | it != vec_handler_will_delete.end(); it++) { |
| 246 | (*it)->get_instance()->clean(); |
| 247 | delete (*it); |
| 248 | } |
| 249 | if (old_root != NULL) delete old_root; |
| 250 | |
| 251 | } |
| 252 | |
| 253 | int plugins_manager::do_request_plugins(int plugin_type, int call_type, |
| 254 | int area, const data_entry *key, const data_entry *value, plugins_root *&root) { |
nothing calls this directly
no test coverage detected