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
1ff01c9b
Commit
1ff01c9b
authored
Apr 27, 2020
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the definitions for ares_getaddrinfo.
parent
adba05d0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
24 deletions
+71
-24
src/gevent/libev/_corecffi_source.c
src/gevent/libev/_corecffi_source.c
+3
-1
src/gevent/resolver/cares_ntop.h
src/gevent/resolver/cares_ntop.h
+0
-7
src/gevent/resolver/cares_pton.h
src/gevent/resolver/cares_pton.h
+0
-8
src/gevent/resolver/dnshelper.c
src/gevent/resolver/dnshelper.c
+0
-2
src/gevent/resolver/libcares.pxd
src/gevent/resolver/libcares.pxd
+51
-2
src/gevent/tests/test__socket_dns.py
src/gevent/tests/test__socket_dns.py
+17
-4
No files found.
src/gevent/libev/_corecffi_source.c
View file @
1ff01c9b
...
...
@@ -76,7 +76,9 @@ static void gevent_zero_prepare(struct ev_prepare* handle)
static
void
gevent_set_ev_alloc
()
{
ev_set_allocator
(
gevent_realloc
);
void
*
(
*
ptr
)(
void
*
,
long
);
ptr
=
(
void
*
(
*
)(
void
*
,
long
))
&
gevent_realloc
;
ev_set_allocator
(
ptr
);
}
#ifdef __clang__
...
...
src/gevent/resolver/cares_ntop.h
deleted
100644 → 0
View file @
adba05d0
#ifdef CARES_EMBED
#include "ares_setup.h"
#include "ares.h"
#else
#include <arpa/inet.h>
#define ares_inet_ntop(w,x,y,z) inet_ntop(w,x,y,z)
#endif
src/gevent/resolver/cares_pton.h
deleted
100644 → 0
View file @
adba05d0
#ifdef CARES_EMBED
#include "ares_setup.h"
#include "ares_inet_net_pton.h"
#else
#include <arpa/inet.h>
#define ares_inet_pton(x,y,z) inet_pton(x,y,z)
#define ares_inet_net_pton(w,x,y,z) inet_net_pton(w,x,y,z)
#endif
src/gevent/resolver/dnshelper.c
View file @
1ff01c9b
...
...
@@ -10,8 +10,6 @@
#include "ares.h"
#include "cares_ntop.h"
#include "cares_pton.h"
#if PY_MAJOR_VERSION >= 3
#define PY3K
...
...
src/gevent/resolver/libcares.pxd
View file @
1ff01c9b
cdef
extern
from
"ares.h"
:
# These two are defined in <sys/socket.h> and <netdb.h>, respectively,
# on POSIX. On Windows, they are in <winsock2.h>. "ares.h" winds up
# indirectly including both of those.
struct
sockaddr
:
pass
struct
hostent
:
pass
struct
ares_options
:
int
flags
void
*
sock_state_cb
...
...
@@ -74,6 +82,7 @@ cdef extern from "ares.h":
int
ARES_NI_LOOKUPHOST
int
ARES_NI_LOOKUPSERVICE
ctypedef
int
ares_socklen_t
int
ares_library_init
(
int
flags
)
void
ares_library_cleanup
()
...
...
@@ -104,6 +113,46 @@ cdef extern from "ares.h":
int
ares_set_servers
(
void
*
channel
,
ares_addr_node
*
servers
)
struct
ares_addrinfo_hints
:
int
ai_flags
int
ai_family
int
ai_socktype
int
ai_protocol
struct
ares_addrinfo_node
:
int
ai_ttl
int
ai_flags
int
ai_family
int
ai_socktype
int
ai_protocol
ares_socklen_t
ai_addrlen
sockaddr
*
ai_addr
ares_addrinfo_node
*
ai_next
struct
ares_addrinfo_cname
:
int
ttl
char
*
alias
char
*
name
ares_addrinfo_cname
*
next
struct
ares_addrinfo
:
ares_addrinfo_cname
*
cnames
ares_addrinfo_node
*
nodes
# typedef void (*ares_addrinfo_callback)(
# void *arg, int status,
# int timeouts,
# ares_addrinfo *result)
void
ares_getaddrinfo
(
void
*
channel
,
const
char
*
name
,
const
char
*
service
,
const
ares_addrinfo_hints
*
hints
,
#ares_addrinfo_callback callback,
void
*
callback
,
void
*
arg
)
void
ares_freeaddrinfo
(
ares_addrinfo
*
ai
)
cdef
extern
from
"cares_pton.h"
:
int
ares_inet_pton
(
int
af
,
char
*
src
,
void
*
dst
)
int
ares_inet_pton
(
int
af
,
const
char
*
src
,
void
*
dst
)
src/gevent/tests/test__socket_dns.py
View file @
1ff01c9b
...
...
@@ -31,6 +31,7 @@ if getattr(resolver, 'pool', None) is not None:
from
gevent.testing.sysinfo
import
RESOLVER_NOT_SYSTEM
from
gevent.testing.sysinfo
import
RESOLVER_DNSPYTHON
from
gevent.testing.sysinfo
import
RESOLVER_ARES
from
gevent.testing.sysinfo
import
PY2
import
gevent.testing.timing
...
...
@@ -39,6 +40,7 @@ assert gevent_socket.gaierror is socket.gaierror
assert
gevent_socket
.
error
is
socket
.
error
TRACE
=
not
util
.
QUIET
and
os
.
getenv
(
'GEVENT_DEBUG'
,
''
)
==
'trace'
RUN_ALL_HOST_TESTS
=
os
.
getenv
(
'GEVENTTEST_RUN_ALL_ETC_HOST_TESTS'
,
''
)
def
trace
(
message
,
*
args
,
**
kwargs
):
if
TRACE
:
...
...
@@ -379,7 +381,17 @@ add(TestTypeError, 25)
class
TestHostname
(
TestCase
):
pass
def
_normalize_result_gethostbyaddr
(
self
,
result
):
result
=
TestCase
.
_normalize_result_gethostbyaddr
(
self
,
result
)
if
RESOLVER_ARES
and
isinstance
(
result
,
tuple
):
# The system resolver can return the FQDN, in the first result,
# when given certain configurations. But c-ares
# does not.
name
=
result
[
0
]
name
=
name
.
split
(
'.'
,
1
)[
0
]
result
=
(
name
,)
+
result
[
1
:]
return
result
add
(
TestHostname
,
...
...
@@ -504,7 +516,7 @@ class TestEtcHosts(TestCase):
hf
=
SanitizedHostsFile
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'hosts_file.txt'
))
all_etc_hosts
=
sorted
(
hf
.
iter_all_host_addr_pairs
())
if
len
(
all_etc_hosts
)
>
cls
.
MAX_HOSTS
and
util
.
QUIET
:
if
len
(
all_etc_hosts
)
>
cls
.
MAX_HOSTS
and
not
RUN_ALL_HOST_TESTS
:
all_etc_hosts
=
all_etc_hosts
[:
cls
.
MAX_HOSTS
]
for
host
,
ip
in
all_etc_hosts
:
...
...
@@ -519,13 +531,14 @@ TestEtcHosts.populate_tests()
class
TestGeventOrg
(
TestCase
):
HOSTNAME
=
'
www.gevent
.org'
HOSTNAME
=
'
python-gevent.readthedocs
.org'
# For this test to work correctly, it needs to resolve to
# an address with a single A record; round-robin DNS and multiple A records
# may mess it up (subsequent requests---and we always make two---may return
# unequal results). We used to use gevent.org, but that now has multiple A records;
# trying www.gevent.org which is a CNAME to readthedocs.org.
# trying www.gevent.org which is a CNAME to readthedocs.org then worked, but it became
# an alias for python-gevent.readthedocs.org, which is an alias for readthedocs.io.
add
(
TestGeventOrg
,
TestGeventOrg
.
HOSTNAME
)
...
...
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