accelerate lookup in non-concatenated pools

This commit is contained in:
Andreas Steffen
2009-07-17 13:58:29 +02:00
parent dfd8ddfb33
commit 848133ff1c
+19 -1
View File
@@ -224,8 +224,25 @@ static host_t* acquire_address(private_sql_attribute_t *this,
identity = get_identity(this, id);
if (identity)
{
char *name;
/* check for a single pool first (no concatenation and enumeration) */
if (strchr(names, ',') == NULL)
{
pool = get_pool(this, names, &timeout);
if (pool)
{
/* check for an existing lease */
address = check_lease(this, names, pool, identity);
if (address == NULL)
{
/* get an unallocated address or expired lease */
address = get_lease(this, names, pool, timeout, identity);
}
}
}
else
{
enumerator_t *enumerator;
char *name;
/* in a first step check for an existing lease over all pools */
enumerator = enumerator_create_token(names, ",", " ");
@@ -260,6 +277,7 @@ static host_t* acquire_address(private_sql_attribute_t *this,
}
enumerator->destroy(enumerator);
}
}
return address;
}