| 1380 | } |
| 1381 | |
| 1382 | void MonClient::handle_command_reply(MCommandReply *reply) |
| 1383 | { |
| 1384 | MonCommand *r = NULL; |
| 1385 | uint64_t tid = reply->get_tid(); |
| 1386 | |
| 1387 | if (tid == 0 && !mon_commands.empty()) { |
| 1388 | r = mon_commands.begin()->second; |
| 1389 | ldout(cct, 10) << __func__ << " has tid 0, assuming it is " << r->tid |
| 1390 | << dendl; |
| 1391 | } else { |
| 1392 | auto p = mon_commands.find(tid); |
| 1393 | if (p == mon_commands.end()) { |
| 1394 | ldout(cct, 10) << __func__ << " " << reply->get_tid() << " not found" |
| 1395 | << dendl; |
| 1396 | reply->put(); |
| 1397 | return; |
| 1398 | } |
| 1399 | r = p->second; |
| 1400 | } |
| 1401 | |
| 1402 | ldout(cct, 10) << __func__ << " " << r->tid << " " << r->cmd << dendl; |
| 1403 | auto ec = reply->r < 0 ? bs::error_code(-reply->r, mon_category()) |
| 1404 | : bs::error_code(); |
| 1405 | _finish_command(r, ec, reply->rs, std::move(reply->get_data())); |
| 1406 | reply->put(); |
| 1407 | } |
| 1408 | |
| 1409 | class MonClient::ContextVerter { |
| 1410 | std::string* outs; |