Commit 0754a173 by Solo Group

inherite on loop

1 parent d736e92b
......@@ -129,7 +129,6 @@ class CommonConnection(Log):
self.log_info('ISO8583 to raw {}'.format([raw]))
def process(self, raw):
self.log_info('PROSES THREAD')
parser = Parser(self, raw)
thread = create_thread(parser.run)
parser_threads.append((parser, thread))
......@@ -165,10 +164,32 @@ class RequestHandler(BaseRequestHandler, CommonConnection):
self.running = False
conn_mgr.add(self)
BaseRequestHandler.handle(self)
# ini ditambahkan
def is_loop(self):
sleep(0.1)
return self.running
def on_loop(self):
raw = self.receive_raw()
if not raw:
if self.is_timeout():
self.close_because_timeout()
return
# i = 0
while True:
raw = self.streamer.get(raw)
# i += 1
# self.log_info(">> RAW {}, {}".format(i, raw))
# self.log_info(">> SISA {}, {}".format(i, self.streamer.raw))
if not raw:
break
raw = self.process(raw)
if raw:
self.send(raw)
raw = ''
def on_receive_raw(self, raw):
self.log_receive_raw(raw)
BaseRequestHandler.on_receive_raw(self, raw)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!