From a7fa1c0d2480aa92bf317f72305f1837fdb6d4bd Mon Sep 17 00:00:00 2001 From: pi-rho Date: Mon, 4 Feb 2013 19:05:31 -0600 Subject: [PATCH] a better execution harness --- extra/start-here.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/extra/start-here.py b/extra/start-here.py index 36a780c..dbda74a 100644 --- a/extra/start-here.py +++ b/extra/start-here.py @@ -88,10 +88,14 @@ class StinkyPinkySession(ip.HtmlSession): # execution harness if __name__ == '__main__': if len(sys.argv) > 1: - s = None - reseq = ip.Dispatch(*sys.argv[1:]) - for h, d in reseq: - srv, first, chunk = d - if not s: - s = StinkyPinkySession(first) - s.handle(srv, first, chunk, reseq.last) + sessions = {} + dp = ip.Dispatch(*sys.argv[1:]) + for fhash, chunk in dp: + is_srv, frame, gs = chunk + if not frame: + continue + if fhash not in sessions: + sessions[fhash] = StinkyPinkySession(frame) + sessions[fhash].handle(is_srv, frame, gs, dp.last) + for sess in sessions.itervalues(): + sess.done()