From cb09488dc8e4b03706a9cc1fa71284a2f7ce33c1 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Tue, 24 Jul 2012 23:49:58 +1200 Subject: Make actions at end of message work. --- libpathod/rparse.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'libpathod/rparse.py') diff --git a/libpathod/rparse.py b/libpathod/rparse.py index 96817304..8b19a1d2 100644 --- a/libpathod/rparse.py +++ b/libpathod/rparse.py @@ -86,6 +86,15 @@ def write_values(fp, vals, actions, sofar=0, skip=0, blocksize=BLOCKSIZE): send_chunk(fp, a[2], blocksize, 0, len(a[2])) send_chunk(fp, v, blocksize, offset, len(v)) sofar += len(v) + # Remainders + while actions: + a = actions.pop() + if a[1] == "pause": + time.sleep(a[2]) + elif a[1] == "disconnect": + return True + elif a[1] == "inject": + send_chunk(fp, a[2], blocksize, 0, len(a[2])) except tcp.NetLibDisconnect: # pragma: no cover return True @@ -434,12 +443,7 @@ class DisconnectAt: @classmethod def expr(klass): e = pp.Literal("d").suppress() - e += e + pp.MatchFirst( - [ - v_integer, - pp.Literal("r") - ] - ) + e += Offset return e.setParseAction(lambda x: klass(*x)) -- cgit v1.2.3