aboutsummaryrefslogtreecommitdiff
path: root/rtr-origin/updater.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2009-03-31 20:43:36 +0000
committerRob Austein <sra@hactrn.net>2009-03-31 20:43:36 +0000
commit23f81386d982be61d6e22e3fee0bd3519af44ab6 (patch)
tree68c08bf133bc2a10e1e2428736575c147cf18a68 /rtr-origin/updater.py
parent80d76ce17dd6977d258f8c33010b7fc1edde2102 (diff)
Checkpoint
svn path=/rtr-origin/updater.py; revision=2293
Diffstat (limited to 'rtr-origin/updater.py')
-rwxr-xr-xrtr-origin/updater.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/rtr-origin/updater.py b/rtr-origin/updater.py
index 2ed53684..db05795f 100755
--- a/rtr-origin/updater.py
+++ b/rtr-origin/updater.py
@@ -198,18 +198,18 @@ class prefix_set(list):
def diff_to_file(self, other, outputfile):
"""Compare this prefix_set with an older one and write a file
- consisting of the changes.
+ consisting of the changes. Since we store prefix_sets in sorted
+ order, computing the difference is a trivial linear comparison.
"""
f = self._pdufile(outputfile, "wb")
old = other[:]
new = self[:]
while old and new:
- if old[0] < new[0]: # Only in old: withdraw prefix
+ if old[0] < new[0]:
f.write(old.pop(0).to_pdu(announce = 0))
- elif old[0] > new[0]: # Only in new: announce prefix
+ elif old[0] > new[0]:
f.write(new.pop(0).to_pdu(announce = 1))
else:
- assert old[0] == new[0]
del old[0]
del new[0]
while old: