Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
c02a1bdd
Commit
c02a1bdd
authored
Jun 09, 2016
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docs about getsockaddr and the ares resolver. Fixes #815.
[skip ci]
parent
b253d790
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
doc/dns.rst
doc/dns.rst
+1
-1
src/gevent/resolver_ares.py
src/gevent/resolver_ares.py
+11
-4
No files found.
doc/dns.rst
View file @
c02a1bdd
...
@@ -6,7 +6,7 @@ gevent includes support for a pluggable hostname resolution system.
...
@@ -6,7 +6,7 @@ gevent includes support for a pluggable hostname resolution system.
Pluggable resolvers are (generally) intended to be cooperative.
Pluggable resolvers are (generally) intended to be cooperative.
This pluggable resolution system is used automatically when the system
This pluggable resolution system is used automatically when the system
is :mod:`monkey patched <gevent.monkey>`, and may be used manually
is :mod:`monkey patched <gevent.monkey>`, and may be used manually
through the :attr:`resolver attribute <gevent.Hub.resolver>` of the
through the :attr:`resolver attribute <gevent.
hub.
Hub.resolver>` of the
:class:`gevent.hub.Hub` or the corresponding methods in the
:class:`gevent.hub.Hub` or the corresponding methods in the
:mod:`gevent.socket` module.
:mod:`gevent.socket` module.
...
...
src/gevent/resolver_ares.py
View file @
c02a1bdd
...
@@ -23,10 +23,13 @@ class Resolver(object):
...
@@ -23,10 +23,13 @@ class Resolver(object):
resolution. c-ares is natively asynchronous at the socket level
resolution. c-ares is natively asynchronous at the socket level
and so integrates well into gevent's event loop.
and so integrates well into gevent's event loop.
In comparison to :class:`gevent.resolver_thread.Resolver`, the
In comparison to :class:`gevent.resolver_thread.Resolver` (which
implementation is much more complex. In addition, there have been
delegates to the native system resolver), the implementation is
reports of it not properly honoring certain system configurations.
much more complex. In addition, there have been reports of it not
However, because it does not use threads, it may scale better.
properly honoring certain system configurations (for example, the
order in which IPv4 and IPv6 results are returned may not match
the threaded resolver). However, because it does not use threads,
it may scale better for applications that make many lookups.
.. caution:: This module is considered extremely experimental on PyPy, and
.. caution:: This module is considered extremely experimental on PyPy, and
due to its implementation in cython, it may be slower. It may also lead to
due to its implementation in cython, it may be slower. It may also lead to
...
@@ -211,6 +214,10 @@ class Resolver(object):
...
@@ -211,6 +214,10 @@ class Resolver(object):
for
socktype
,
proto
in
socktype_proto
:
for
socktype
,
proto
in
socktype_proto
:
dest
.
append
((
AF_INET6
,
socktype
,
proto
,
''
,
sockaddr
))
dest
.
append
((
AF_INET6
,
socktype
,
proto
,
''
,
sockaddr
))
# As of 2016, some platforms return IPV6 first and some do IPV4 first,
# and some might even allow configuration of which is which. For backwards
# compatibility with earlier releases (but not necessarily resolver_thread!)
# we return 4 first. See https://github.com/gevent/gevent/issues/815 for more.
result
+=
result4
+
result6
result
+=
result4
+
result6
if
not
result
:
if
not
result
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment