mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-10 13:04:23 -04:00
Remove all trailing whitespace from end-of-line.
svn:r1350
This commit is contained in:
parent
d4e3671fb4
commit
5d71b25b51
@ -12,7 +12,7 @@
|
|||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. The name of the author may not be used to endorse or promote products
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
2
event.h
2
event.h
@ -126,7 +126,7 @@
|
|||||||
callbacks have been registered for a given URI.
|
callbacks have been registered for a given URI.
|
||||||
|
|
||||||
@section evrpc A framework for RPC servers and clients
|
@section evrpc A framework for RPC servers and clients
|
||||||
|
|
||||||
libevents provides a framework for creating RPC servers and clients. It
|
libevents provides a framework for creating RPC servers and clients. It
|
||||||
takes care of marshaling and unmarshaling all data structures.
|
takes care of marshaling and unmarshaling all data structures.
|
||||||
|
|
||||||
|
@ -728,7 +728,7 @@ class EntryString(Entry):
|
|||||||
|
|
||||||
def CodeClear(self, structname):
|
def CodeClear(self, structname):
|
||||||
code = [ 'if (%s->%s_set == 1) {' % (structname, self.Name()),
|
code = [ 'if (%s->%s_set == 1) {' % (structname, self.Name()),
|
||||||
' free (%s->%s_data);' % (structname, self.Name()),
|
' free(%s->%s_data);' % (structname, self.Name()),
|
||||||
' %s->%s_data = NULL;' % (structname, self.Name()),
|
' %s->%s_data = NULL;' % (structname, self.Name()),
|
||||||
' %s->%s_set = 0;' % (structname, self.Name()),
|
' %s->%s_set = 0;' % (structname, self.Name()),
|
||||||
'}'
|
'}'
|
||||||
@ -914,7 +914,7 @@ class EntryStruct(Entry):
|
|||||||
|
|
||||||
def CodeFree(self, name):
|
def CodeFree(self, name):
|
||||||
code = ['if (%s->%s_data != NULL)' % (name, self._name),
|
code = ['if (%s->%s_data != NULL)' % (name, self._name),
|
||||||
' %s_free(%s->%s_data); ' % (
|
' %s_free(%s->%s_data);' % (
|
||||||
self._refname, name, self._name)]
|
self._refname, name, self._name)]
|
||||||
|
|
||||||
return code
|
return code
|
||||||
@ -1030,7 +1030,7 @@ class EntryVarBytes(Entry):
|
|||||||
|
|
||||||
def CodeFree(self, name):
|
def CodeFree(self, name):
|
||||||
code = ['if (%s->%s_data != NULL)' % (name, self._name),
|
code = ['if (%s->%s_data != NULL)' % (name, self._name),
|
||||||
' free (%s->%s_data); ' % (name, self._name)]
|
' free(%s->%s_data);' % (name, self._name)]
|
||||||
|
|
||||||
return code
|
return code
|
||||||
|
|
||||||
@ -1479,7 +1479,7 @@ def GetNextStruct(file):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if len(tokens[1]):
|
if len(tokens[1]):
|
||||||
raise RpcGenError('Trailing garbage after struct on line %d'
|
raise RpcGenError('Trailing garbage after struct on line %d'
|
||||||
% line_count)
|
% line_count)
|
||||||
|
|
||||||
# We found the end of the struct
|
# We found the end of the struct
|
||||||
@ -1676,7 +1676,7 @@ class CommandLine:
|
|||||||
entry.PrintCode(impl_fp)
|
entry.PrintCode(impl_fp)
|
||||||
impl_fp.close()
|
impl_fp.close()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
CommandLine(sys.argv).run()
|
CommandLine(sys.argv).run()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
@ -60,7 +60,7 @@ struct _evrpc_hooks {
|
|||||||
/* hooks for processing outbound and inbound rpcs */
|
/* hooks for processing outbound and inbound rpcs */
|
||||||
struct evrpc_hook_list in_hooks;
|
struct evrpc_hook_list in_hooks;
|
||||||
struct evrpc_hook_list out_hooks;
|
struct evrpc_hook_list out_hooks;
|
||||||
|
|
||||||
struct evrpc_pause_list pause_requests;
|
struct evrpc_pause_list pause_requests;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ struct evrpc_req_generic {
|
|||||||
/* the empty reply object that needs to be filled in */
|
/* the empty reply object that needs to be filled in */
|
||||||
void *reply;
|
void *reply;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* the static structure for this rpc; that can be used to
|
* the static structure for this rpc; that can be used to
|
||||||
* automatically unmarshal and marshal the http buffers.
|
* automatically unmarshal and marshal the http buffers.
|
||||||
*/
|
*/
|
||||||
|
2
evrpc.c
2
evrpc.c
@ -1106,7 +1106,7 @@ evrpc_register_generic(struct evrpc_base *base, const char *name,
|
|||||||
int (*rpl_complete)(void *),
|
int (*rpl_complete)(void *),
|
||||||
void (*rpl_marshal)(struct evbuffer *, void *))
|
void (*rpl_marshal)(struct evbuffer *, void *))
|
||||||
{
|
{
|
||||||
struct evrpc* rpc =
|
struct evrpc* rpc =
|
||||||
evrpc_register_object(name, req_new, req_free, req_unmarshal,
|
evrpc_register_object(name, req_new, req_free, req_unmarshal,
|
||||||
rpl_new, rpl_free, rpl_complete, rpl_marshal);
|
rpl_new, rpl_free, rpl_complete, rpl_marshal);
|
||||||
if (rpc == NULL)
|
if (rpc == NULL)
|
||||||
|
@ -63,7 +63,7 @@ struct evhttp_connection {
|
|||||||
struct bufferevent *bufev;
|
struct bufferevent *bufev;
|
||||||
|
|
||||||
struct event retry_ev; /* for retrying connects */
|
struct event retry_ev; /* for retrying connects */
|
||||||
|
|
||||||
char *bind_address; /* address to use for binding the src */
|
char *bind_address; /* address to use for binding the src */
|
||||||
u_short bind_port; /* local port for binding the src */
|
u_short bind_port; /* local port for binding the src */
|
||||||
|
|
||||||
@ -78,17 +78,17 @@ struct evhttp_connection {
|
|||||||
int timeout; /* timeout in seconds for events */
|
int timeout; /* timeout in seconds for events */
|
||||||
int retry_cnt; /* retry count */
|
int retry_cnt; /* retry count */
|
||||||
int retry_max; /* maximum number of retries */
|
int retry_max; /* maximum number of retries */
|
||||||
|
|
||||||
enum evhttp_connection_state state;
|
enum evhttp_connection_state state;
|
||||||
|
|
||||||
/* for server connections, the http server they are connected with */
|
/* for server connections, the http server they are connected with */
|
||||||
struct evhttp *http_server;
|
struct evhttp *http_server;
|
||||||
|
|
||||||
TAILQ_HEAD(evcon_requestq, evhttp_request) requests;
|
TAILQ_HEAD(evcon_requestq, evhttp_request) requests;
|
||||||
|
|
||||||
void (*cb)(struct evhttp_connection *, void *);
|
void (*cb)(struct evhttp_connection *, void *);
|
||||||
void *cb_arg;
|
void *cb_arg;
|
||||||
|
|
||||||
void (*closecb)(struct evhttp_connection *, void *);
|
void (*closecb)(struct evhttp_connection *, void *);
|
||||||
void *closecb_arg;
|
void *closecb_arg;
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ struct evhttp {
|
|||||||
TAILQ_HEAD(httpcbq, evhttp_cb) callbacks;
|
TAILQ_HEAD(httpcbq, evhttp_cb) callbacks;
|
||||||
struct evconq connections;
|
struct evconq connections;
|
||||||
|
|
||||||
TAILQ_HEAD(vhostsq, evhttp) virtualhosts;
|
TAILQ_HEAD(vhostsq, evhttp) virtualhosts;
|
||||||
|
|
||||||
/* NULL if this server is not a vhost */
|
/* NULL if this server is not a vhost */
|
||||||
char *vhost_pattern;
|
char *vhost_pattern;
|
||||||
|
@ -120,8 +120,8 @@ int evhttp_accept_socket(struct evhttp *http, evutil_socket_t fd);
|
|||||||
void evhttp_free(struct evhttp* http);
|
void evhttp_free(struct evhttp* http);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set a callback for a specified URI
|
Set a callback for a specified URI
|
||||||
|
|
||||||
@param http the http sever on which to set the callback
|
@param http the http sever on which to set the callback
|
||||||
@param path the path for which to invoke the callback
|
@param path the path for which to invoke the callback
|
||||||
@param cb the callback function that gets invoked on requesting path
|
@param cb the callback function that gets invoked on requesting path
|
||||||
|
@ -68,7 +68,7 @@ extern "C" {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Determines if the member has been set in the message
|
Determines if the member has been set in the message
|
||||||
|
|
||||||
@param msg the message to inspect
|
@param msg the message to inspect
|
||||||
@param member the member variable to test for presences
|
@param member the member variable to test for presences
|
||||||
@return 1 if it's present or 0 otherwise.
|
@return 1 if it's present or 0 otherwise.
|
||||||
@ -245,7 +245,7 @@ struct evrpc_request_wrapper *evrpc_make_request_ctx(
|
|||||||
(void (*)(void *))rplystruct##_clear, \
|
(void (*)(void *))rplystruct##_clear, \
|
||||||
(int (*)(void *, struct evbuffer *))rplystruct##_unmarshal); \
|
(int (*)(void *, struct evbuffer *))rplystruct##_unmarshal); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Provides access to the HTTP request object underlying an RPC
|
/** Provides access to the HTTP request object underlying an RPC
|
||||||
*
|
*
|
||||||
* Access to the underlying http object; can be used to look at headers or
|
* Access to the underlying http object; can be used to look at headers or
|
||||||
@ -261,18 +261,18 @@ struct evrpc_request_wrapper *evrpc_make_request_ctx(
|
|||||||
void evrpc_request_done(struct evrpc_req_generic *req);
|
void evrpc_request_done(struct evrpc_req_generic *req);
|
||||||
|
|
||||||
/** Creates the reply to an RPC request
|
/** Creates the reply to an RPC request
|
||||||
*
|
*
|
||||||
* EVRPC_REQUEST_DONE is used to answer a request; the reply is expected
|
* EVRPC_REQUEST_DONE is used to answer a request; the reply is expected
|
||||||
* to have been filled in. The request and reply pointers become invalid
|
* to have been filled in. The request and reply pointers become invalid
|
||||||
* after this call has finished.
|
* after this call has finished.
|
||||||
*
|
*
|
||||||
* @param rpc_req the rpc request structure provided to the server callback
|
* @param rpc_req the rpc request structure provided to the server callback
|
||||||
*/
|
*/
|
||||||
#define EVRPC_REQUEST_DONE(rpc_req) do { \
|
#define EVRPC_REQUEST_DONE(rpc_req) do { \
|
||||||
struct evrpc_req_generic *_req = (struct evrpc_req_generic *)(rpc_req); \
|
struct evrpc_req_generic *_req = (struct evrpc_req_generic *)(rpc_req); \
|
||||||
evrpc_request_done(_req); \
|
evrpc_request_done(_req); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
struct evrpc_base;
|
struct evrpc_base;
|
||||||
struct evhttp;
|
struct evhttp;
|
||||||
@ -287,7 +287,7 @@ struct evhttp;
|
|||||||
*/
|
*/
|
||||||
struct evrpc_base *evrpc_init(struct evhttp *server);
|
struct evrpc_base *evrpc_init(struct evhttp *server);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Frees the evrpc base
|
* Frees the evrpc base
|
||||||
*
|
*
|
||||||
* For now, you are responsible for making sure that no rpcs are ongoing.
|
* For now, you are responsible for making sure that no rpcs are ongoing.
|
||||||
@ -385,7 +385,7 @@ struct evrpc_status;
|
|||||||
int evrpc_make_request(struct evrpc_request_wrapper *ctx);
|
int evrpc_make_request(struct evrpc_request_wrapper *ctx);
|
||||||
|
|
||||||
/** creates an rpc connection pool
|
/** creates an rpc connection pool
|
||||||
*
|
*
|
||||||
* a pool has a number of connections associated with it.
|
* a pool has a number of connections associated with it.
|
||||||
* rpc requests are always made via a pool.
|
* rpc requests are always made via a pool.
|
||||||
*
|
*
|
||||||
@ -410,7 +410,7 @@ void evrpc_pool_free(struct evrpc_pool *pool);
|
|||||||
* @param pool the pool to which to add the connection
|
* @param pool the pool to which to add the connection
|
||||||
* @param evcon the connection to add to the pool.
|
* @param evcon the connection to add to the pool.
|
||||||
*/
|
*/
|
||||||
void evrpc_pool_add_connection(struct evrpc_pool *pool,
|
void evrpc_pool_add_connection(struct evrpc_pool *pool,
|
||||||
struct evhttp_connection *evcon);
|
struct evhttp_connection *evcon);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -538,7 +538,7 @@ void evrpc_hook_add_meta(void *ctx, const char *key,
|
|||||||
int evrpc_hook_find_meta(void *ctx, const char *key,
|
int evrpc_hook_find_meta(void *ctx, const char *key,
|
||||||
void **data, size_t *data_size);
|
void **data, size_t *data_size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the connection object associated with the request
|
* returns the connection object associated with the request
|
||||||
*
|
*
|
||||||
* @param ctx the context provided to the hook call
|
* @param ctx the context provided to the hook call
|
||||||
@ -564,7 +564,7 @@ int evrpc_send_request_generic(struct evrpc_pool *pool,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Function for registering a generic RPC with the RPC base.
|
Function for registering a generic RPC with the RPC base.
|
||||||
|
|
||||||
Do not call this function directly, use EVRPC_REGISTER() instead.
|
Do not call this function directly, use EVRPC_REGISTER() instead.
|
||||||
|
|
||||||
@see EVRPC_REGISTER()
|
@see EVRPC_REGISTER()
|
||||||
|
@ -38,7 +38,7 @@ extern "C" {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* provides information about the completed RPC request.
|
* provides information about the completed RPC request.
|
||||||
*/
|
*/
|
||||||
struct evrpc_status {
|
struct evrpc_status {
|
||||||
@ -79,7 +79,7 @@ struct evrpc {
|
|||||||
|
|
||||||
/* verifies that the reply is valid */
|
/* verifies that the reply is valid */
|
||||||
int (*reply_complete)(void *);
|
int (*reply_complete)(void *);
|
||||||
|
|
||||||
/* marshals the reply into a buffer */
|
/* marshals the reply into a buffer */
|
||||||
void (*reply_marshal)(struct evbuffer*, void *);
|
void (*reply_marshal)(struct evbuffer*, void *);
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ multiple_write_cb(int fd, short event, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
woff += len;
|
woff += len;
|
||||||
|
|
||||||
if (woff >= sizeof(wbuf)) {
|
if (woff >= sizeof(wbuf)) {
|
||||||
shutdown(fd, SHUT_WR);
|
shutdown(fd, SHUT_WR);
|
||||||
if (usepersist)
|
if (usepersist)
|
||||||
@ -975,12 +975,12 @@ test_event_base_new(void *ptr)
|
|||||||
int towrite = strlen(TEST1)+1;
|
int towrite = strlen(TEST1)+1;
|
||||||
int len = write(data->pair[0], TEST1, towrite);
|
int len = write(data->pair[0], TEST1, towrite);
|
||||||
|
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
tt_abort_perror("initial write");
|
tt_abort_perror("initial write");
|
||||||
else if (len != towrite)
|
else if (len != towrite)
|
||||||
tt_abort_printf(("initial write fell short (%d of %d bytes)",
|
tt_abort_printf(("initial write fell short (%d of %d bytes)",
|
||||||
len, towrite));
|
len, towrite));
|
||||||
|
|
||||||
if (shutdown(data->pair[0], SHUT_WR))
|
if (shutdown(data->pair[0], SHUT_WR))
|
||||||
tt_abort_perror("initial write shutdown");
|
tt_abort_perror("initial write shutdown");
|
||||||
|
|
||||||
|
@ -1362,7 +1362,7 @@ http_bad_header_test(void *ptr)
|
|||||||
|
|
||||||
static int validate_header(
|
static int validate_header(
|
||||||
const struct evkeyvalq* headers,
|
const struct evkeyvalq* headers,
|
||||||
const char *key, const char *value)
|
const char *key, const char *value)
|
||||||
{
|
{
|
||||||
const char *real_val = evhttp_find_header(headers, key);
|
const char *real_val = evhttp_find_header(headers, key);
|
||||||
tt_assert(real_val != NULL);
|
tt_assert(real_val != NULL);
|
||||||
@ -1377,7 +1377,7 @@ http_parse_query_test(void *ptr)
|
|||||||
struct evkeyvalq headers;
|
struct evkeyvalq headers;
|
||||||
|
|
||||||
TAILQ_INIT(&headers);
|
TAILQ_INIT(&headers);
|
||||||
|
|
||||||
evhttp_parse_query("http://www.test.com/?q=test", &headers);
|
evhttp_parse_query("http://www.test.com/?q=test", &headers);
|
||||||
tt_want(validate_header(&headers, "q", "test") == 0);
|
tt_want(validate_header(&headers, "q", "test") == 0);
|
||||||
evhttp_clear_headers(&headers);
|
evhttp_clear_headers(&headers);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user