summaryrefslogtreecommitdiffabout
path: root/src/dbrw.h
authorSergey Poznyakoff <gray@gnu.org.ua>2018-01-30 21:00:05 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2018-01-30 21:06:11 (GMT)
commit4fef83230e851189fd3541f095c47a952968a411 (patch) (side-by-side diff)
tree021413ec3602ca4d0e0a0ee0f588d0a2782155ae /src/dbrw.h
parente946449ccf15a0f44f402b03812d31d5f8ef4f7b (diff)
downloadvmod-dbrw-4fef83230e851189fd3541f095c47a952968a411.tar.gz
vmod-dbrw-4fef83230e851189fd3541f095c47a952968a411.tar.bz2
Introduce connection idle timeout.
* NEWS: Updated. * configure.ac: Version 2.2.90 * doc/vmod-dbrw.3: Document connection idle timeout. * doc/vmod-dbrw.texi: Likewise. * src/dbrw.h (dbrw_backend) <sql_idle_timeout>: New method. (dbrw_config)<idle_timeout>: New member. (dbrw_connection)<timestamp>: New member. (sql_idle_timeout): New proto. * src/mysql.c (vmod_mysql_data) <mysql>: Change storage. All uses changed. (s_mysql_idle_timeout): New function. * src/sql.c (sql_idle_timeout): New function. (sql_query): Update connection timestamp. (sql_idle_timeout): New function. * src/vmod_dbrw.c (dbrw_connection_get): Force disconnect if connection remained idle for too long. Initialize cfg->idle_timeout. (vmod_config): New parameter 'timeout='
Diffstat (limited to 'src/dbrw.h') (more/less context) (ignore whitespace changes)
-rw-r--r--src/dbrw.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dbrw.h b/src/dbrw.h
index 438d963..7a0ee52 100644
--- a/src/dbrw.h
+++ b/src/dbrw.h
@@ -1,5 +1,5 @@
/* This file is part of vmod-dbrw
- Copyright (C) 2013-2017 Sergey Poznyakoff
+ Copyright (C) 2013-2018 Sergey Poznyakoff
Vmod-dbrw is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -43,6 +43,7 @@ struct dbrw_backend {
int (*sql_free_result) (struct dbrw_connection *);
const char *(*sql_get_column)(struct dbrw_connection *, unsigned,
unsigned);
+ int (*sql_idle_timeout)(struct dbrw_connection *);
};
enum {
@@ -66,6 +67,7 @@ struct dbrw_config {
int qdisp;
int regflags;
char status[HTTP_STATUS_LEN+1];
+ int idle_timeout;
VTAILQ_ENTRY(dbrw_config) list;
};
@@ -77,7 +79,8 @@ struct dbrw_connection {
struct dbrw_config *conf; /* Pointer to the configuration data */
regmatch_t *matches; /* Match map */
size_t matchsize; /* Total number of entries in match map */
- void *data; /* Backend-specific data */
+ time_t timestamp; /* Last used at */
+ void *data; /* Backend-specific data */
VTAILQ_ENTRY(dbrw_connection) list;
};
@@ -105,6 +108,7 @@ unsigned sql_num_fields(struct dbrw_connection *pd);
void sql_free_result(struct dbrw_connection *pd);
void sql_destroy(struct dbrw_connection *pd);
const char *sql_get_column(struct dbrw_connection *pd, unsigned row, unsigned col);
+int sql_idle_timeout(struct dbrw_connection *conn);
char *findparam(char **params, char *name);

Return to:

Send suggestions and report system problems to the System administrator.