--- vpopmail-5.4.13.orig/vmysql.c Thu Dec 16 13:57:34 2004 +++ vpopmail-5.4.13/vmysql.c Sun Feb 11 05:44:48 2007 @@ -186,9 +186,9 @@ */ int vauth_open_update() { - unsigned int timeout = 2; + unsigned int timeout = 20; - if ( update_open != 0 ) return(0); + if ( update_open && (mysql_ping(&mysql_update)==0) ) return(0); update_open = 1; verrori = load_connection_info(); @@ -237,6 +237,7 @@ */ int vauth_open_read() { + unsigned int timeout = 20; /* if we are already connected, just return */ if ( read_open != 0 ) return(0); read_open = 1; @@ -245,6 +246,7 @@ verrori = load_connection_info(); if (verrori) return -1; mysql_init(&mysql_read); + mysql_options(&mysql_read, MYSQL_OPT_CONNECT_TIMEOUT, (char *)&timeout); if (!(mysql_real_connect(&mysql_read, MYSQL_READ_SERVER, MYSQL_READ_USER, MYSQL_READ_PASSWD, MYSQL_READ_DATABASE, MYSQL_READ_PORT, NULL, 0))) {