]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
common/pick_address: refactor pick_addresses() 43531/head
authorKefu Chai <tchaikov@gmail.com>
Wed, 13 Oct 2021 23:51:31 +0000 (07:51 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 14 Oct 2021 05:38:27 +0000 (05:38 +0000)
commit45d9eff5e4faf9f2fe91a48ec71e7147c589e771
tree62e21284ee98fabc168d86e2936863f1f793ca56
parent8661ba180759e16daa550b43537d2bbc56a82551
common/pick_address: refactor pick_addresses()

* consolidate the logic handling CEPH_PICK_ADDRESS_PREFER_IPV4 using
  std::sort(). this might be overkill. but it helps to explain
  what CEPH_PICK_ADDRESS_PREFER_IPV4 is for, and helps to dedup
  the code to order the addresses.
* let fill_in_one_address() return an optional<entity_addrvec_t>.
  more readable this way
* early return if the required address is not found, instead of
  checking variables like ipv4_r
* rename fill_in_one_address() to get_one_address() to reflect
  the change of the function's return value's type

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/common/pick_address.cc