From 54e3465575a9413e2f324f7a5c5102eb8646ced2 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Mon, 14 Nov 2016 20:19:26 +0100 Subject: [PATCH] HTML parser queue flush fix - the queue wasn't correctly flushed --- src/bitmessageqt/safehtmlparser.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/bitmessageqt/safehtmlparser.py b/src/bitmessageqt/safehtmlparser.py index 1ca9cbb0..8009f02c 100644 --- a/src/bitmessageqt/safehtmlparser.py +++ b/src/bitmessageqt/safehtmlparser.py @@ -120,6 +120,13 @@ class SafeHTMLParser(HTMLParser): parserProcess = multiprocessing.Process(target=regexpSubprocess, name="RegExParser", args=(parserInputQueue, parserOutputQueue)) parserProcess.start() parserLock.release() + # flush queue + try: + while True: + tmp = parserOutputQueue.get(False) + except Queue.Empty: + logger.debug("Parser queue flushed") + pass parserInputQueue.put(tmp) try: tmp = parserOutputQueue.get(True, 1) @@ -130,14 +137,6 @@ class SafeHTMLParser(HTMLParser): parserProcess = multiprocessing.Process(target=regexpSubprocess, name="RegExParser", args=(parserInputQueue, parserOutputQueue)) parserProcess.start() parserLock.release() - else: - # flush queue - try: - while True: - tmp = parserOutputQueue.get(False) - except Queue.Empty: - logger.debug("Parser queue flushed") - pass self.raw += tmp