Added session timeouts.

The parameter 'connection_timeout' for services takes a value as seconds.
All sessions that have been idle for longer than this will be disconnected.
This commit is contained in:
Markus Makela
2015-02-20 22:16:43 +02:00
parent 3145ebac43
commit c47d2f3791
14 changed files with 101 additions and 4 deletions

View File

@ -261,7 +261,7 @@ typedef struct dcb {
SPINLOCK polloutlock;
int polloutbusy;
int writecheck;
time_t last_read; /*< Last time the DCB received data */
unsigned int high_water; /**< High water mark */
unsigned int low_water; /**< Low water mark */
struct server *server; /**< The associated backend server */

View File

@ -142,6 +142,7 @@ typedef struct service {
rate_limit; /**< The refresh rate limit for users table */
FILTER_DEF **filters; /**< Ordered list of filters */
int n_filters; /**< Number of filters */
int conn_timeout; /*< Session timeout in seconds */
char *weightby;
struct service *next; /**< The next service in the linked list */
} SERVICE;
@ -172,6 +173,7 @@ extern int serviceSetUser(SERVICE *, char *, char *);
extern int serviceGetUser(SERVICE *, char **, char **);
extern void serviceSetFilters(SERVICE *, char *);
extern int serviceEnableRootUser(SERVICE *, int );
extern int serviceSetTimeout(SERVICE *, int );
extern void serviceWeightBy(SERVICE *, char *);
extern char *serviceGetWeightingParameter(SERVICE *);
extern int serviceEnableLocalhostMatchWildcardHost(SERVICE *, int);

View File

@ -33,6 +33,7 @@
* 02-09-2013 Massimiliano Pinto Added session ref counter
* 29-05-2014 Mark Riddoch Support for filter mechanism
* added
* 20-02-2015 Markus Mäkelä Added session timeouts
*
* @endverbatim
*/
@ -167,5 +168,6 @@ bool session_link_dcb(SESSION *, struct dcb *);
SESSION* get_session_by_router_ses(void* rses);
void session_enable_log(SESSION* ses, logfile_id_t id);
void session_disable_log(SESSION* ses, logfile_id_t id);
void session_close_timeouts(void* data);
#endif