mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-19 01:04:58 -04:00
http: fix conflicts EVHTTP_CON_AUTOFREE and EVHTTP_CON_REUSE_CONNECTED_ADDR
And we can't make them continuous, since the latest is a public API, and otherwise we will break binary compatibility. Also extra check for EVHTTP_CON_PUBLIC_FLAGS_END, in case somebody forgot about this (implementer I mean). Refs: #182
This commit is contained in:
parent
365f181aa3
commit
4dc09795c0
@ -71,10 +71,11 @@ struct evhttp_connection {
|
||||
ev_uint64_t max_body_size;
|
||||
|
||||
int flags;
|
||||
#define EVHTTP_CON_INCOMING 0x0001 /* only one request on it ever */
|
||||
#define EVHTTP_CON_OUTGOING 0x0002 /* multiple requests possible */
|
||||
#define EVHTTP_CON_CLOSEDETECT 0x0004 /* detecting if persistent close */
|
||||
#define EVHTTP_CON_AUTOFREE 0x0008 /* set when we want to auto free the connection */
|
||||
#define EVHTTP_CON_INCOMING 0x0001 /* only one request on it ever */
|
||||
#define EVHTTP_CON_OUTGOING 0x0002 /* multiple requests possible */
|
||||
#define EVHTTP_CON_CLOSEDETECT 0x0004 /* detecting if persistent close */
|
||||
/* set when we want to auto free the connection */
|
||||
#define EVHTTP_CON_AUTOFREE EVHTTP_CON_PUBLIC_FLAGS_END
|
||||
|
||||
struct timeval timeout; /* timeout for events */
|
||||
int retry_cnt; /* retry count */
|
||||
|
11
http.c
11
http.c
@ -2342,13 +2342,14 @@ void evhttp_connection_set_family(struct evhttp_connection *evcon,
|
||||
int evhttp_connection_set_flags(struct evhttp_connection *evcon,
|
||||
int flags)
|
||||
{
|
||||
if (flags & ~(EVHTTP_CON_REUSE_CONNECTED_ADDR)) {
|
||||
int avail_flags = 0;
|
||||
avail_flags |= EVHTTP_CON_REUSE_CONNECTED_ADDR;
|
||||
|
||||
if (flags & ~avail_flags || flags > EVHTTP_CON_PUBLIC_FLAGS_END)
|
||||
return 1;
|
||||
}
|
||||
evcon->flags &= ~avail_flags;
|
||||
|
||||
evcon->flags &= ~(EVHTTP_CON_REUSE_CONNECTED_ADDR);
|
||||
|
||||
evcon->flags |= EVHTTP_CON_REUSE_CONNECTED_ADDR;
|
||||
evcon->flags |= flags;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -637,7 +637,10 @@ EVENT2_EXPORT_SYMBOL
|
||||
void evhttp_connection_set_family(struct evhttp_connection *evcon,
|
||||
int family);
|
||||
|
||||
#define EVHTTP_CON_REUSE_CONNECTED_ADDR 0x0008 /* reuse connection address on retry */
|
||||
/* reuse connection address on retry */
|
||||
#define EVHTTP_CON_REUSE_CONNECTED_ADDR 0x0008
|
||||
/* Padding for public flags, @see EVHTTP_CON_* in http-internal.h */
|
||||
#define EVHTTP_CON_PUBLIC_FLAGS_END 0x100000
|
||||
/**
|
||||
* Set connection flags.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user