Unlike all the other message-handling functions, we don't put away a reference * because we want to support MMonMap passthrough to other Dispatchers. */
| 412 | /* Unlike all the other message-handling functions, we don't put away a reference |
| 413 | * because we want to support MMonMap passthrough to other Dispatchers. */ |
| 414 | void MonClient::handle_monmap(MMonMap *m) |
| 415 | { |
| 416 | ldout(cct, 10) << __func__ << " " << *m << dendl; |
| 417 | auto con_addrs = m->get_source_addrs(); |
| 418 | string old_name = monmap.get_name(con_addrs); |
| 419 | const auto old_epoch = monmap.get_epoch(); |
| 420 | |
| 421 | auto p = m->monmapbl.cbegin(); |
| 422 | decode(monmap, p); |
| 423 | |
| 424 | ldout(cct, 10) << " got monmap " << monmap.epoch |
| 425 | << " from mon." << old_name |
| 426 | << " (according to old e" << monmap.get_epoch() << ")" |
| 427 | << dendl; |
| 428 | ldout(cct, 10) << "dump:\n"; |
| 429 | monmap.print(*_dout); |
| 430 | *_dout << dendl; |
| 431 | |
| 432 | if (old_epoch != monmap.get_epoch()) { |
| 433 | tried.clear(); |
| 434 | } |
| 435 | if (old_name.size() == 0) { |
| 436 | ldout(cct,10) << " can't identify which mon we were connected to" << dendl; |
| 437 | _reopen_session(); |
| 438 | } else { |
| 439 | auto new_name = monmap.get_name(con_addrs); |
| 440 | if (new_name.empty()) { |
| 441 | ldout(cct, 10) << "mon." << old_name << " at " << con_addrs |
| 442 | << " went away" << dendl; |
| 443 | // can't find the mon we were talking to (above) |
| 444 | _reopen_session(); |
| 445 | } else if (messenger->should_use_msgr2() && |
| 446 | monmap.get_addrs(new_name).has_msgr2() && |
| 447 | !con_addrs.has_msgr2()) { |
| 448 | ldout(cct,1) << " mon." << new_name << " has (v2) addrs " |
| 449 | << monmap.get_addrs(new_name) << " but i'm connected to " |
| 450 | << con_addrs << ", reconnecting" << dendl; |
| 451 | _reopen_session(); |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | cct->set_mon_addrs(monmap); |
| 456 | |
| 457 | sub.got("monmap", monmap.get_epoch()); |
| 458 | map_cond.notify_all(); |
| 459 | want_monmap = false; |
| 460 | |
| 461 | if (authenticate_err == 1) { |
| 462 | _finish_auth(0); |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | void MonClient::handle_config(MConfig *m) |
| 467 | { |
nothing calls this directly
no test coverage detected