diff options
author | Martin Willi <martin@revosec.ch> | 2013-03-19 16:48:53 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2013-03-19 16:50:39 +0100 |
commit | 33524f02f90e74631980163e6d58145091d2cab8 (patch) | |
tree | 3d38c7e33b4cdddb0f705dac02c1b360f51d33c4 /src | |
parent | 21f40fe891009bf78ff5b7af1e51ccef572002c5 (diff) | |
download | strongswan-33524f02f90e74631980163e6d58145091d2cab8.tar.bz2 strongswan-33524f02f90e74631980163e6d58145091d2cab8.tar.xz |
Check if for some reason we handle a HA segment on both nodes
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/plugins/ha/ha_segments.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/libcharon/plugins/ha/ha_segments.c b/src/libcharon/plugins/ha/ha_segments.c index 45ffa875a..a4ea9ef9a 100644 --- a/src/libcharon/plugins/ha/ha_segments.c +++ b/src/libcharon/plugins/ha/ha_segments.c @@ -289,12 +289,13 @@ static void start_watchdog(private_ha_segments_t *this) METHOD(ha_segments_t, handle_status, void, private_ha_segments_t *this, segment_mask_t mask) { - segment_mask_t missing; + segment_mask_t missing, twice; int i; this->mutex->lock(this->mutex); missing = ~(this->active | mask); + twice = this->active & mask; for (i = 1; i <= this->count; i++) { @@ -311,6 +312,19 @@ METHOD(ha_segments_t, handle_status, void, enable_disable(this, i, FALSE, TRUE); } } + if (twice & SEGMENTS_BIT(i)) + { + if (this->node == i % 2) + { + DBG1(DBG_CFG, "HA segment %d was handled twice, taking", i); + enable_disable(this, i, TRUE, TRUE); + } + else + { + DBG1(DBG_CFG, "HA segment %d was handled twice, dropping", i); + enable_disable(this, i, FALSE, TRUE); + } + } } this->condvar->signal(this->condvar); |