diff -u vpopmail-5.4.13.org/vmysql.c vpopmail-5.4.13/vmysql.c --- vpopmail-5.4.13.org/vmysql.c 2004-12-16 23:57:34.000000000 +0800 +++ vpopmail-5.4.13/vmysql.c 2006-03-31 09:42:45.000000000 +0800 @@ -188,7 +188,7 @@ { unsigned int timeout = 2; - if ( update_open != 0 ) return(0); + if ( update_open && (mysql_ping(&mysql_update)==0) ) return(0); update_open = 1; verrori = load_connection_info(); @@ -238,7 +238,7 @@ int vauth_open_read() { /* if we are already connected, just return */ - if ( read_open != 0 ) return(0); + if ( read_open && (mysql_ping(&mysql_read)==0) ) return(0); read_open = 1; /* connect to mysql and set the database */