aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki/async.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2009-05-12 03:39:37 +0000
committerRob Austein <sra@hactrn.net>2009-05-12 03:39:37 +0000
commit48244b53cef3acef2d5e726e903ea2ec71bd2136 (patch)
treef68dcf1fba76b02fe4e9b85e11ee0a1350d9af5d /rpkid/rpki/async.py
parentc450547374d179e4740c869f9645ed9d1e4aeb48 (diff)
Cleanup some of the litter left behind during conversion to callbacks.
Add rpki.async.iterator.__repr__() so we can figure out where the silly things were created when debugging. Fix sloppy child process shutdown in testbed.main(); I don't know why this only started complaining now, but it did, so I fixed it. svn path=/rpkid/pubd.py; revision=2426
Diffstat (limited to 'rpkid/rpki/async.py')
-rw-r--r--rpkid/rpki/async.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/rpkid/rpki/async.py b/rpkid/rpki/async.py
index c581dbb0..1c295f76 100644
--- a/rpkid/rpki/async.py
+++ b/rpkid/rpki/async.py
@@ -45,6 +45,8 @@ class iterator(object):
def __init__(self, iterable, item_callback, done_callback):
self.item_callback = item_callback
self.done_callback = done_callback
+ self.caller_file, self.caller_line, self.caller_function = traceback.extract_stack(limit = 2)[0][0:3]
+ #rpki.log.debug("Created iterator id %s file %s line %s function %s" % (id(self), self.caller_file, self.caller_line, self.caller_function))
try:
self.iterator = iter(iterable)
except ExitNow:
@@ -54,13 +56,23 @@ class iterator(object):
raise
self()
- def __call__(self, *ignored):
+ def __repr__(self):
+ return "<asynciterator created at %s:%d %s at 0x%x>" % (self.caller_file, self.caller_line, self.caller_function, id(self))
+
+ def __call__(self, *args):
+ if args != ():
+ rpki.log.warn("Arguments passed to %r: %r" % (self, args))
+ for x in traceback.format_stack():
+ rpki.log.warn(x.strip())
+ assert args == ()
try:
self.item_callback(self, self.iterator.next())
except StopIteration:
if self.done_callback is not None:
self.done_callback()
+ def ignore(self, ignored):
+ self()
class timer(object):
"""