allow connections to be removed from an rpc pool

svn:r753
This commit is contained in:
Niels Provos 2008-05-01 01:45:00 +00:00
parent d76cca7273
commit 85c4904bc5
3 changed files with 31 additions and 6 deletions

View File

@ -80,6 +80,7 @@ Changes in current version:
o use libevent's internal timercmp on all platforms, to avoid bugs on old platforms where timercmp(a,b,<=) is buggy.
o Remove the never-exported, never-used evhttp_hostportfile function.
o Support input/output filters for bufferevents; somewhat similar to libio's model. This will allow us to implement SSL, compression, etc, transparently to users of bufferevents such as the http layer.
o allow connections to be removed from an rpc pool
Changes in 1.4.0:
o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.

10
evrpc.c
View File

@ -541,7 +541,8 @@ evrpc_pool_free(struct evrpc_pool *pool)
void
evrpc_pool_add_connection(struct evrpc_pool *pool,
struct evhttp_connection *connection) {
struct evhttp_connection *connection)
{
assert(connection->http_server == NULL);
TAILQ_INSERT_TAIL(&pool->connections, connection, next);
@ -571,6 +572,13 @@ evrpc_pool_add_connection(struct evrpc_pool *pool,
}
}
void
evrpc_pool_remove_connection(struct evrpc_pool *pool,
struct evhttp_connection *connection)
{
TAILQ_REMOVE(&pool->connections, connection, next);
}
void
evrpc_pool_set_timeout(struct evrpc_pool *pool, int timeout_in_secs)
{

26
evrpc.h
View File

@ -430,12 +430,28 @@ struct evrpc_pool *evrpc_pool_new(struct event_base *base);
* @see evrpc_pool_new()
*/
void evrpc_pool_free(struct evrpc_pool *pool);
/*
* adds a connection over which rpc can be dispatched. the connection
* object must have been newly created.
/**
* Adds a connection over which rpc can be dispatched to the pool.
*
* The connection object must have been newly created.
*
* @param pool the pool to which to add the connection
* @param evcon the connection to add to the pool.
*/
void evrpc_pool_add_connection(struct evrpc_pool *,
struct evhttp_connection *);
void evrpc_pool_add_connection(struct evrpc_pool *pool,
struct evhttp_connection *evcon);
/**
* Removes a connection from the pool.
*
* The connection object must have been newly created.
*
* @param pool the pool from which to remove the connection
* @param evcon the connection to remove from the pool.
*/
void evrpc_pool_remove_connection(struct evrpc_pool *pool,
struct evhttp_connection *evcon);
/**
* Sets the timeout in secs after which a request has to complete. The