Merge pull request #2124 from weaveworks/idempotent-tombstone
make DNS tombstoning idempotent
This commit is contained in:
commit
afff92c248
1 file changed
+7
-4
+7
-4
@@ -109,9 +109,13 @@ func (e1 *Entry) addLowercase() {
|
|||||||
e1.lHostname = strings.ToLower(e1.Hostname)
|
e1.lHostname = strings.ToLower(e1.Hostname)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e1 *Entry) tombstone() {
|
func (e1 *Entry) tombstone() bool {
|
||||||
e1.Version++
|
if e1.Tombstone > 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
e1.Tombstone = now()
|
e1.Tombstone = now()
|
||||||
|
e1.Version++
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func check(es SortableEntries) error {
|
func check(es SortableEntries) error {
|
||||||
@@ -190,8 +194,7 @@ func (es *Entries) tombstone(ourname mesh.PeerName, f func(*Entry) bool) Entries
|
|||||||
|
|
||||||
tombstoned := Entries{}
|
tombstoned := Entries{}
|
||||||
for i, e := range *es {
|
for i, e := range *es {
|
||||||
if f(&e) && e.Origin == ourname {
|
if f(&e) && e.Origin == ourname && e.tombstone() {
|
||||||
e.tombstone()
|
|
||||||
(*es)[i] = e
|
(*es)[i] = e
|
||||||
tombstoned = append(tombstoned, e)
|
tombstoned = append(tombstoned, e)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user