Enable/disable inactive/active segments only

This commit is contained in:
Martin Willi 2009-09-23 10:42:05 +02:00 committed by Martin Willi
parent 310498f3de
commit 9fdf5f712e
1 changed files with 10 additions and 4 deletions

View File

@ -127,13 +127,19 @@ static void enable_disable(private_ha_sync_segments_t *this, u_int segment,
{
if (enable)
{
this->active |= SEGMENTS_BIT(i);
this->kernel->activate(this->kernel, i);
if (!(this->active & SEGMENTS_BIT(i)))
{
this->active |= SEGMENTS_BIT(i);
this->kernel->activate(this->kernel, i);
}
}
else
{
this->active &= ~SEGMENTS_BIT(i);
this->kernel->deactivate(this->kernel, i);
if (this->active & SEGMENTS_BIT(i))
{
this->active &= ~SEGMENTS_BIT(i);
this->kernel->deactivate(this->kernel, i);
}
}
}