mirror of
https://github.com/cuberite/libevent.git
synced 2025-08-06 18:56:40 -04:00
Export an ev_socklen_t.
svn:r1391
This commit is contained in:
parent
75fe762e03
commit
7c20a6ae52
@ -5,6 +5,7 @@ Changes in 2.0.3-alpha:
|
|||||||
o Export new evutil_ascii_* functions to perform locale-independent character type operations.
|
o Export new evutil_ascii_* functions to perform locale-independent character type operations.
|
||||||
o Try to compile better with MSVC: patches from Brodie Thiesfield
|
o Try to compile better with MSVC: patches from Brodie Thiesfield
|
||||||
o New evconnlistener_get_fd function to expose a listener's associated socket.
|
o New evconnlistener_get_fd function to expose a listener's associated socket.
|
||||||
|
o Expose an ev_socklen_t type for consistent use across platforms.
|
||||||
|
|
||||||
Changes in 2.0.2-alpha:
|
Changes in 2.0.2-alpha:
|
||||||
o Add a new flag to bufferevents to make all callbacks automatically deferred.
|
o Add a new flag to bufferevents to make all callbacks automatically deferred.
|
||||||
|
14
evdns.c
14
evdns.c
@ -222,7 +222,7 @@ struct reply {
|
|||||||
struct nameserver {
|
struct nameserver {
|
||||||
evutil_socket_t socket; /* a connected UDP socket */
|
evutil_socket_t socket; /* a connected UDP socket */
|
||||||
struct sockaddr_storage address;
|
struct sockaddr_storage address;
|
||||||
socklen_t addrlen;
|
ev_socklen_t addrlen;
|
||||||
int failed_times; /* number of times which we have given this server a chance */
|
int failed_times; /* number of times which we have given this server a chance */
|
||||||
int timedout; /* number of times in a row a request has timed out */
|
int timedout; /* number of times in a row a request has timed out */
|
||||||
struct event event;
|
struct event event;
|
||||||
@ -284,7 +284,7 @@ struct server_request {
|
|||||||
u16 trans_id; /* Transaction id. */
|
u16 trans_id; /* Transaction id. */
|
||||||
struct evdns_server_port *port; /* Which port received this request on? */
|
struct evdns_server_port *port; /* Which port received this request on? */
|
||||||
struct sockaddr_storage addr; /* Where to send the response */
|
struct sockaddr_storage addr; /* Where to send the response */
|
||||||
socklen_t addrlen; /* length of addr */
|
ev_socklen_t addrlen; /* length of addr */
|
||||||
|
|
||||||
int n_answer; /* how many answer RRs have been set? */
|
int n_answer; /* how many answer RRs have been set? */
|
||||||
int n_authority; /* how many authority RRs have been set? */
|
int n_authority; /* how many authority RRs have been set? */
|
||||||
@ -339,8 +339,8 @@ struct evdns_base {
|
|||||||
|
|
||||||
/** Port to bind to for outgoing DNS packets. */
|
/** Port to bind to for outgoing DNS packets. */
|
||||||
struct sockaddr_storage global_outgoing_address;
|
struct sockaddr_storage global_outgoing_address;
|
||||||
/** Socklen_t for global_outgoing_address. 0 if it isn't set. */
|
/** ev_socklen_t for global_outgoing_address. 0 if it isn't set. */
|
||||||
socklen_t global_outgoing_addrlen;
|
ev_socklen_t global_outgoing_addrlen;
|
||||||
|
|
||||||
struct search_state *global_search_state;
|
struct search_state *global_search_state;
|
||||||
|
|
||||||
@ -1104,7 +1104,7 @@ reply_parse(struct evdns_base *base, u8 *packet, int length) {
|
|||||||
/* a DNS client (addr,addrlen), and if it's well-formed, call the corresponding */
|
/* a DNS client (addr,addrlen), and if it's well-formed, call the corresponding */
|
||||||
/* callback. */
|
/* callback. */
|
||||||
static int
|
static int
|
||||||
request_parse(u8 *packet, int length, struct evdns_server_port *port, struct sockaddr *addr, socklen_t addrlen)
|
request_parse(u8 *packet, int length, struct evdns_server_port *port, struct sockaddr *addr, ev_socklen_t addrlen)
|
||||||
{
|
{
|
||||||
int j = 0; /* index into packet */
|
int j = 0; /* index into packet */
|
||||||
u16 _t; /* used by the macros */
|
u16 _t; /* used by the macros */
|
||||||
@ -1334,7 +1334,7 @@ nameserver_pick(struct evdns_base *base) {
|
|||||||
static void
|
static void
|
||||||
nameserver_read(struct nameserver *ns) {
|
nameserver_read(struct nameserver *ns) {
|
||||||
struct sockaddr_storage ss;
|
struct sockaddr_storage ss;
|
||||||
socklen_t addrlen = sizeof(ss);
|
ev_socklen_t addrlen = sizeof(ss);
|
||||||
u8 packet[1500];
|
u8 packet[1500];
|
||||||
ASSERT_LOCKED(ns->base);
|
ASSERT_LOCKED(ns->base);
|
||||||
|
|
||||||
@ -1368,7 +1368,7 @@ static void
|
|||||||
server_port_read(struct evdns_server_port *s) {
|
server_port_read(struct evdns_server_port *s) {
|
||||||
u8 packet[1500];
|
u8 packet[1500];
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
socklen_t addrlen;
|
ev_socklen_t addrlen;
|
||||||
int r;
|
int r;
|
||||||
ASSERT_LOCKED(s);
|
ASSERT_LOCKED(s);
|
||||||
|
|
||||||
|
2
evutil.c
2
evutil.c
@ -198,7 +198,7 @@ evutil_make_listen_socket_reuseable(evutil_socket_t sock)
|
|||||||
* listener is closed." On Windows, though, it means "don't keep other
|
* listener is closed." On Windows, though, it means "don't keep other
|
||||||
* processes from binding to this address while we're using it. */
|
* processes from binding to this address while we're using it. */
|
||||||
return setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &one,
|
return setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &one,
|
||||||
(socklen_t)sizeof(one));
|
(ev_socklen_t)sizeof(one));
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
12
http.c
12
http.c
@ -195,7 +195,7 @@ extern int debug;
|
|||||||
static int socket_connect(evutil_socket_t kefd, const char *address, unsigned short port);
|
static int socket_connect(evutil_socket_t kefd, const char *address, unsigned short port);
|
||||||
static evutil_socket_t bind_socket_ai(struct addrinfo *, int reuse);
|
static evutil_socket_t bind_socket_ai(struct addrinfo *, int reuse);
|
||||||
static evutil_socket_t bind_socket(const char *, ev_uint16_t, int reuse);
|
static evutil_socket_t bind_socket(const char *, ev_uint16_t, int reuse);
|
||||||
static void name_from_addr(struct sockaddr *, socklen_t, char **, char **);
|
static void name_from_addr(struct sockaddr *, ev_socklen_t, char **, char **);
|
||||||
static int evhttp_associate_new_request_with_connection(
|
static int evhttp_associate_new_request_with_connection(
|
||||||
struct evhttp_connection *evcon);
|
struct evhttp_connection *evcon);
|
||||||
static void evhttp_connection_start_detectclose(
|
static void evhttp_connection_start_detectclose(
|
||||||
@ -1153,7 +1153,7 @@ evhttp_connection_cb(struct bufferevent *bufev, void *arg)
|
|||||||
{
|
{
|
||||||
struct evhttp_connection *evcon = arg;
|
struct evhttp_connection *evcon = arg;
|
||||||
int error;
|
int error;
|
||||||
socklen_t errsz = sizeof(error);
|
ev_socklen_t errsz = sizeof(error);
|
||||||
|
|
||||||
/* Check if the connection completed */
|
/* Check if the connection completed */
|
||||||
if (getsockopt(evcon->fd, SOL_SOCKET, SO_ERROR, (void*)&error,
|
if (getsockopt(evcon->fd, SOL_SOCKET, SO_ERROR, (void*)&error,
|
||||||
@ -2365,7 +2365,7 @@ accept_socket(evutil_socket_t fd, short what, void *arg)
|
|||||||
{
|
{
|
||||||
struct evhttp *http = arg;
|
struct evhttp *http = arg;
|
||||||
struct sockaddr_storage ss;
|
struct sockaddr_storage ss;
|
||||||
socklen_t addrlen = sizeof(ss);
|
ev_socklen_t addrlen = sizeof(ss);
|
||||||
evutil_socket_t nfd;
|
evutil_socket_t nfd;
|
||||||
|
|
||||||
if ((nfd = accept(fd, (struct sockaddr *)&ss, &addrlen)) == -1) {
|
if ((nfd = accept(fd, (struct sockaddr *)&ss, &addrlen)) == -1) {
|
||||||
@ -2755,7 +2755,7 @@ struct evbuffer *evhttp_request_get_output_buffer(struct evhttp_request *req)
|
|||||||
static struct evhttp_connection*
|
static struct evhttp_connection*
|
||||||
evhttp_get_request_connection(
|
evhttp_get_request_connection(
|
||||||
struct evhttp* http,
|
struct evhttp* http,
|
||||||
evutil_socket_t fd, struct sockaddr *sa, socklen_t salen)
|
evutil_socket_t fd, struct sockaddr *sa, ev_socklen_t salen)
|
||||||
{
|
{
|
||||||
struct evhttp_connection *evcon;
|
struct evhttp_connection *evcon;
|
||||||
char *hostname = NULL, *portname = NULL;
|
char *hostname = NULL, *portname = NULL;
|
||||||
@ -2814,7 +2814,7 @@ evhttp_associate_new_request_with_connection(struct evhttp_connection *evcon)
|
|||||||
|
|
||||||
void
|
void
|
||||||
evhttp_get_request(struct evhttp *http, evutil_socket_t fd,
|
evhttp_get_request(struct evhttp *http, evutil_socket_t fd,
|
||||||
struct sockaddr *sa, socklen_t salen)
|
struct sockaddr *sa, ev_socklen_t salen)
|
||||||
{
|
{
|
||||||
struct evhttp_connection *evcon;
|
struct evhttp_connection *evcon;
|
||||||
|
|
||||||
@ -2873,7 +2873,7 @@ addr_from_name(char *address)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
name_from_addr(struct sockaddr *sa, socklen_t salen,
|
name_from_addr(struct sockaddr *sa, ev_socklen_t salen,
|
||||||
char **phost, char **pport)
|
char **phost, char **pport)
|
||||||
{
|
{
|
||||||
char ntop[NI_MAXHOST];
|
char ntop[NI_MAXHOST];
|
||||||
|
@ -118,6 +118,14 @@ extern "C" {
|
|||||||
#define ev_ssize_t ssize_t
|
#define ev_ssize_t ssize_t
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#define ev_socklen_t int
|
||||||
|
#elif defined(_EVENT_socklen_t)
|
||||||
|
#define ev_socklen_t _EVENT_socklen_t
|
||||||
|
#else
|
||||||
|
#define ev_socklen_t socklen_t
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
/** A type wide enough to hold the output of "socket()" or "accept()". On
|
/** A type wide enough to hold the output of "socket()" or "accept()". On
|
||||||
* Windows, this is an intptr_t; elsewhere, it is an int. */
|
* Windows, this is an intptr_t; elsewhere, it is an int. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user