-
Notifications
You must be signed in to change notification settings - Fork 10
Add reverse DNS resolution support to resolver #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughAdds endpoint-based reverse DNS resolution: new public Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client
participant Resolver as Resolver
participant Impl as ResolverImpl
participant Worker as WorkerThread
participant Scheduler as Scheduler
Client->>Resolver: co_await resolve(endpoint, flags)
Resolver->>Impl: reverse_resolve(coro, executor, endpoint, flags, stop_token, ec*, result*)
Impl->>Worker: spawn worker thread (getnameinfo / GetNameInfoW)
Worker->>Worker: perform lookup, convert strings
Worker->>Impl: populate op (host/service, error)
Worker->>Scheduler: post completion op
Scheduler->>Impl: invoke op() -> resume coroutine
Impl->>Client: coroutine resumes with reverse_resolver_result
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
|
An automated preview of the documentation is available at https://85.corosio.prtest3.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-01-26 22:33:15 UTC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@src/corosio/src/detail/iocp/resolver_service.cpp`:
- Around line 19-23: The file using std::memcpy (resolver_service.cpp) is
missing the <cstring> include; add `#include` <cstring> near the other includes
(alongside <thread> and boost headers) so std::memcpy is provided directly
rather than relying on transitive includes used by functions like memcpy in the
reverse path.
In `@src/corosio/src/detail/iocp/resolver_service.hpp`:
- Around line 269-286: Update the file-level overview comment to reflect that
reverse DNS resolution now spawns worker threads and that shutdown is tracked;
explicitly mention the presence of thread bookkeeping methods (thread_started,
thread_finished, is_shutting_down) and state members (shutting_down_,
active_threads_) as part of the shutdown protocol, and note that resolver
instances are tracked via resolver_list_ and resolver_ptrs_. Keep the summary
concise, remove the outdated claim that this path avoids worker threads, and add
a short sentence describing the purpose of the condition variable cv_ and
win_mutex mutex_ in coordinating thread shutdown.
In `@src/corosio/src/detail/posix/resolver_service.cpp`:
- Around line 703-794: The file uses std::memcpy inside
posix_resolver_impl::reverse_resolve (in resolver_service.cpp) but does not
include <cstring>; add an explicit `#include` <cstring> at the top of the file so
std::memcpy is available without relying on transitive includes (this touches
resolver_service.cpp where reverse_resolve and std::memcpy are used).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #85 +/- ##
===========================================
+ Coverage 84.19% 84.58% +0.38%
===========================================
Files 43 43
Lines 2822 2951 +129
===========================================
+ Hits 2376 2496 +120
- Misses 446 455 +9 see 5 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
1daa1c4 to
2d43af0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/corosio/src/detail/iocp/resolver_service.cpp`:
- Around line 435-452: GetNameInfoW's return value should be stored directly
into reverse_op_.gai_error instead of calling ::WSAGetLastError(); in the block
after calling GetNameInfoW (use the GetNameInfoW call and reverse_op_ locals to
find the spot), set reverse_op_.gai_error = result when result != 0 and set
reverse_op_.gai_error = 0 when result == 0 (while still populating
reverse_op_.stored_host and reverse_op_.stored_service via from_wide as
currently done).
Implement reverse DNS lookup capability for the resolver class, enabling hostname lookups from IP addresses using getnameinfo() on POSIX and GetNameInfoW() on Windows. New API: - resolve(endpoint) - reverse resolve with default flags - resolve(endpoint, reverse_flags) - reverse resolve with custom flags - reverse_flags enum (numeric_host, numeric_service, name_required, datagram_service) - reverse_resolver_result class with endpoint(), host_name(), service_name() Implementation uses worker threads on both platforms since the underlying APIs (getnameinfo/GetNameInfoW) are synchronous. Thread lifetime is managed via shared_ptr to prevent use-after-free during shutdown.
2d43af0 to
332b97d
Compare
Implement reverse DNS lookup capability for the resolver class, enabling hostname lookups from IP addresses using getnameinfo() on POSIX and GetNameInfoW() on Windows.
New API:
Implementation uses worker threads on both platforms since the underlying APIs (getnameinfo/GetNameInfoW) are synchronous. Thread lifetime is managed via shared_ptr to prevent use-after-free during shutdown.
Resolves #64.
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.