tpop3d-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tpop3d-discuss][PATCH]: mysql and reconnection


From: Arkadiusz Miskiewicz
Subject: [tpop3d-discuss][PATCH]: mysql and reconnection
Date: Thu, 14 Dec 2006 16:03:11 +0100
User-agent: KMail/1.9.5

The problem is that reconnect behaviour is different for
libmysqclient < 5.0.3 (reconnect is ON by default)
and for libmysqclient >= 5.0.3 (reconnect is OFF by default)

What is desired behaviour? mysql_ping() can do reconnection.
IMO it should be defined explictly and probably should be off
because there is already manual reconnection routine few lines
below mysql_ping().

Index: auth_mysql.c
===================================================================
RCS file: /home/chris/vcvs/repos/tpop3d/auth_mysql.c,v
retrieving revision 1.56
diff -u -u -r1.56 auth_mysql.c
--- auth_mysql.c        19 Aug 2004 23:57:05 -0000      1.56
+++ auth_mysql.c        14 Dec 2006 14:47:11 -0000
@@ -85,6 +85,7 @@
     static MYSQL mysql_handle;
     char *password;
     unsigned int timeout;
+    my_bool want_reconnect = 0;
 
     if (mysql && mysql_ping(mysql) == 0)
         /* The current server is up and running. */
@@ -113,6 +114,9 @@
         timeout = 5;
         mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char*)&(timeout));
 
+       /* We don't want automatic reconnect to happen. */
+       mysql_options(mysql, MYSQL_OPT_RECONNECT, &want_reconnect);
+
         if (mysql_real_connect(mysql, mysql_servers->toks[n],
                 config_get_string("auth-mysql-username"),
                 password,


-- 
Arkadiusz Miƛkiewicz        PLD/Linux Team
arekm / maven.pl            http://ftp.pld-linux.org/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]