Skip to content

Index hashmaps of IP addresses by Address::ConstInstanceSharedPtr not string #29529

Closed as not planned

Description

@ravenblackx

Title: Index hashmaps of IP addresses by Address::ConstInstanceSharedPtr not string

Description:
Per #29137 (comment) it's suggested that indexing addresses as strings is not ideal. The suggestion is that we could, with a custom hash and custom equality operator, used the existing SharedPtr of the address object, for fewer conversions and faster comparisons. This would be appropriate for listener_worker_routers_ and the upcoming/new UdpForwardingContext in hot_restarting_child.h.

Some caveats as to why this might not have been done before:

  1. For environments without proper dynamic_cast support, ip4addr==ip6addr and vice-versa comparison is currently undefined behavior. (Could be fixed by checking the type before casting, like rhs.ip() != nullptr && rhs.ip().ipv4() != nullptr, and casting should actually not be necessary at all.)
  2. If the map is indexed on smart pointers, I don't think you can look up a value using a reference, so in a context where you don't have a smart pointer available this could be problematic.

Activity

  1. added
    enhancement
    triage
    on Sep 8, 2023
  2. removed
    triage
    on Sep 11, 2023
  3. github-actions commented on Oct 11, 2023

    @github-actions

    This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

  4. added
    stale
    on Oct 11, 2023
  5. github-actions commented on Oct 18, 2023

    @github-actions

    This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions