| 1088 | } |
| 1089 | |
| 1090 | Status DestroyPort(ServerContext*, const DestroyPortRequest* request, |
| 1091 | EmptyResponse* response) override { |
| 1092 | std::lock_guard<std::recursive_mutex> lock(mutex_); |
| 1093 | |
| 1094 | const char* port_name; |
| 1095 | int ret; |
| 1096 | |
| 1097 | if (!request->name().length()) |
| 1098 | return return_with_error(response, EINVAL, |
| 1099 | "Argument must be a name in str"); |
| 1100 | |
| 1101 | port_name = request->name().c_str(); |
| 1102 | const auto& it = PortBuilder::all_ports().find(port_name); |
| 1103 | if (it == PortBuilder::all_ports().end()) |
| 1104 | return return_with_error(response, ENOENT, "No port `%s' found", |
| 1105 | port_name); |
| 1106 | |
| 1107 | ret = PortBuilder::DestroyPort(it->second); |
| 1108 | if (ret) { |
| 1109 | return return_with_errno(response, -ret); |
| 1110 | } |
| 1111 | |
| 1112 | return Status::OK; |
| 1113 | } |
| 1114 | |
| 1115 | Status GetPortStats(ServerContext*, const GetPortStatsRequest* request, |
| 1116 | GetPortStatsResponse* response) override { |
nothing calls this directly
no test coverage detected