apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevac Marko <ma...@kevac.org>
Subject mod_dbd: new options for MySQL timeouts
Date Fri, 20 Nov 2009 15:00:24 GMT
 This patch adds connection, write and read timeout options for apr_dbd_mysql

diff --git a/dbd/apr_dbd_mysql.c b/dbd/apr_dbd_mysql.c
index 77fa5fb..e7745a6 100644
--- a/dbd/apr_dbd_mysql.c
+++ b/dbd/apr_dbd_mysql.c
@@ -1115,6 +1115,9 @@ static apr_dbd_t *dbd_mysql_open(apr_pool_t
*pool, const char *params,
         {"fldsz", NULL},
         {"group", NULL},
         {"reconnect", NULL},
+        {"connecttimeout", NULL},
+        {"readtimeout", NULL},
+        {"writetimeout", NULL},
         {NULL, NULL}
     };
     unsigned int port = 0;
@@ -1171,6 +1174,18 @@ static apr_dbd_t *dbd_mysql_open(apr_pool_t
*pool, const char *params,
          do_reconnect = atoi(fields[9].value) ? 1 : 0;
     }
 #endif
+    if (fields[10].value != NULL) {
+         mysql_options(sql->conn, MYSQL_OPT_CONNECT_TIMEOUT,
+                       atoi(fields[10].value));
+    }
+    if (fields[11].value != NULL) {
+         mysql_options(sql->conn, MYSQL_OPT_READ_TIMEOUT,
+                       atoi(fields[11].value));
+    }
+    if (fields[12].value != NULL) {
+         mysql_options(sql->conn, MYSQL_OPT_WRITE_TIMEOUT,
+                       atoi(fields[12].value));
+    }

 #if MYSQL_VERSION_ID >= 50013
     /* the MySQL manual says this should be BEFORE mysql_real_connect */

-- 
Marko Kevac
Sent from Moscow, Mow, Russia

Mime
View raw message