MCPcopy Create free account
hub / github.com/NetSys/bess / DestroyModule

Method DestroyModule

core/bessctl.cc:1245–1273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1243 }
1244
1245 Status DestroyModule(ServerContext*, const DestroyModuleRequest* request,
1246 EmptyResponse* response) override {
1247 std::lock_guard<std::recursive_mutex> lock(mutex_);
1248
1249 WorkerPauser wp;
1250 const char* m_name;
1251 Module* m;
1252
1253 if (!request->name().length())
1254 return return_with_error(response, EINVAL,
1255 "Argument must be a name in str");
1256 m_name = request->name().c_str();
1257
1258 const auto& it = ModuleGraph::GetAllModules().find(request->name());
1259 if (it == ModuleGraph::GetAllModules().end()) {
1260 return return_with_error(response, ENOENT, "No module '%s' found",
1261 m_name);
1262 }
1263 m = it->second;
1264
1265 auto& resume_modules = bess::event_modules[bess::Event::PreResume];
1266 if (resume_modules.erase(m) > 0) {
1267 VLOG(1) << "Cleared pre-resume hook for module '" << m->name() << "'";
1268 }
1269
1270 ModuleGraph::DestroyModule(m);
1271
1272 return Status::OK;
1273 }
1274
1275 Status GetModuleInfo(ServerContext*, const GetModuleInfoRequest* request,
1276 GetModuleInfoResponse* response) override {

Callers

nothing calls this directly

Calls 2

return_with_errorFunction · 0.85
endMethod · 0.45

Tested by

no test coverage detected