fixed two bugs introduced by the stroke ip pool refactoring
This commit is contained in:
@@ -194,7 +194,7 @@ static host_t* acquire_address(private_stroke_attribute_t *this,
|
|||||||
auth_info_t *auth, host_t *requested)
|
auth_info_t *auth, host_t *requested)
|
||||||
{
|
{
|
||||||
pool_t *pool;
|
pool_t *pool;
|
||||||
uintptr_t offset;
|
uintptr_t offset = 0;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
identification_t *old_id;
|
identification_t *old_id;
|
||||||
|
|
||||||
@@ -202,6 +202,13 @@ static host_t* acquire_address(private_stroke_attribute_t *this,
|
|||||||
pool = find_pool(this, name);
|
pool = find_pool(this, name);
|
||||||
while (pool)
|
while (pool)
|
||||||
{
|
{
|
||||||
|
/* handle %config case by mirroring requested address */
|
||||||
|
if (pool->size == 0)
|
||||||
|
{
|
||||||
|
this->mutex->unlock(this->mutex);
|
||||||
|
return requested->clone(requested);
|
||||||
|
}
|
||||||
|
|
||||||
/* check for a valid offline lease, refresh */
|
/* check for a valid offline lease, refresh */
|
||||||
offset = (uintptr_t)pool->offline->remove(pool->offline, id);
|
offset = (uintptr_t)pool->offline->remove(pool->offline, id);
|
||||||
if (offset)
|
if (offset)
|
||||||
@@ -291,7 +298,7 @@ static bool release_address(private_stroke_attribute_t *this,
|
|||||||
id = pool->ids->get(pool->ids, id);
|
id = pool->ids->get(pool->ids, id);
|
||||||
if (id)
|
if (id)
|
||||||
{
|
{
|
||||||
DBG1(DBG_CFG, "lease %H of %D gone offline", address, id);
|
DBG1(DBG_CFG, "lease %H to %D went offline", address, id);
|
||||||
pool->offline->put(pool->offline, id, (void*)offset);
|
pool->offline->put(pool->offline, id, (void*)offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user