Revert "mirrorlist: Use a thread-local copy of the tree to prevent changing the global one"
This reverts commit 738e67c90c
.
This commit is contained in:
parent
738e67c90c
commit
ae66c3f1ce
1 changed files with 3 additions and 5 deletions
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
# standard library modules in alphabetical order
|
# standard library modules in alphabetical order
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
import copy
|
|
||||||
import datetime
|
import datetime
|
||||||
import getopt
|
import getopt
|
||||||
import logging
|
import logging
|
||||||
|
@ -235,12 +234,11 @@ def tree_lookup(tree, ip, field, maxResults=None):
|
||||||
# and we'll get a new copy of the tree from our parent the next time it
|
# and we'll get a new copy of the tree from our parent the next time it
|
||||||
# fork()s.
|
# fork()s.
|
||||||
# returns a list of tuples (prefix, data)
|
# returns a list of tuples (prefix, data)
|
||||||
ltree = copy.deepcopy(tree)
|
|
||||||
result = []
|
result = []
|
||||||
len_data = 0
|
len_data = 0
|
||||||
if ip is None:
|
if ip is None:
|
||||||
return result
|
return result
|
||||||
node = ltree.search_best(ip.strNormal())
|
node = tree.search_best(ip.strNormal())
|
||||||
while node is not None:
|
while node is not None:
|
||||||
prefix = node.prefix
|
prefix = node.prefix
|
||||||
if type(node.data[field]) == list:
|
if type(node.data[field]) == list:
|
||||||
|
@ -250,8 +248,8 @@ def tree_lookup(tree, ip, field, maxResults=None):
|
||||||
t = (prefix, node.data[field],)
|
t = (prefix, node.data[field],)
|
||||||
result.append(t)
|
result.append(t)
|
||||||
if maxResults is None or len_data < maxResults:
|
if maxResults is None or len_data < maxResults:
|
||||||
ltree.delete(prefix)
|
tree.delete(prefix)
|
||||||
node = ltree.search_best(ip.strNormal())
|
node = tree.search_best(ip.strNormal())
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue