summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2002-05-29 15:29:43 +0300
committerunknown <Sinisa@sinisa.nasamreza.org>2002-05-29 15:29:43 +0300
commit324cb57baf9462223e0f5c5b848e0876763dec7d (patch)
tree432130f1317754c5e68ae518047c4e46691009e9
parentb7529249294f20f1b966ea48e46c8e907bae007d (diff)
parentaea0ae808f28983bbe2d9dcff7f1c83e781903cb (diff)
downloadmariadb-git-324cb57baf9462223e0f5c5b848e0876763dec7d.tar.gz
Merge sinisa@work.mysql.com:/home/bk/mysql-4.0
into sinisa.nasamreza.org:/mnt/hdc/Sinisa/mysql-4.0
-rw-r--r--sql/sql_parse.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 123a95070b9..4b4c085814a 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -160,7 +160,7 @@ static int get_or_create_user_conn(THD *thd, const char *user,
uc->connections = 1;
uc->questions=uc->updates=uc->conn_per_hour=0;
uc->user_resources=*mqh;
- if (mqh->connections > max_user_connections)
+ if (max_user_connections && mqh->connections > max_user_connections)
uc->user_resources.connections = max_user_connections;
uc->intime=thd->thr_create_time;
if (hash_insert(&hash_user_connections, (byte*) uc))
@@ -298,7 +298,7 @@ static int check_for_max_user_connections(USER_CONN *uc)
goto end;
}
uc->connections++;
-if (uc->user_resources.connections && uc->conn_per_hour++ >= uc->user_resources.connections)
+ if (uc->user_resources.connections && uc->conn_per_hour++ >= uc->user_resources.connections)
{
net_printf(&current_thd->net, ER_USER_LIMIT_REACHED, uc->user, "max_connections",
(long) uc->user_resources.connections);
@@ -317,12 +317,7 @@ static void decrease_user_connections(USER_CONN *uc)
*/
DBUG_ENTER("decrease_user_connections");
- if (mqh_used)
- {
- if (uc->conn_per_hour)
- uc->conn_per_hour--;
- }
- else if (!--uc->connections)
+ if (!mqh_used && uc->connections && !--uc->connections)
{
/* Last connection for user; Delete it */
(void) pthread_mutex_lock(&LOCK_user_conn);