mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 02:10:59 +00:00
Refactoring.
This commit is contained in:
parent
c3105153a5
commit
d917cfd916
@ -1023,6 +1023,10 @@ class ConsoleMaster(flow.FlowMaster):
|
||||
self.onekey = False
|
||||
self.view_connlist()
|
||||
|
||||
self.masterq = Queue.Queue()
|
||||
slave = controller.Slave(self.masterq, self.server)
|
||||
slave.start()
|
||||
|
||||
self.ui.run_wrapper(self.loop)
|
||||
# If True, quit just pops out to connection list view.
|
||||
print >> sys.stderr, "Shutting down..."
|
||||
@ -1294,16 +1298,12 @@ class ConsoleMaster(flow.FlowMaster):
|
||||
return size
|
||||
|
||||
def loop(self):
|
||||
q = Queue.Queue()
|
||||
self.masterq = q
|
||||
slave = controller.Slave(q, self.server)
|
||||
slave.start()
|
||||
try:
|
||||
while not controller.exit:
|
||||
startloop = time.time()
|
||||
self.statusbar.redraw()
|
||||
size = self.drawscreen()
|
||||
self.tick(q)
|
||||
self.tick(self.masterq)
|
||||
self.ui.set_input_timeouts(max_wait=0.1)
|
||||
keys = self.ui.get_input()
|
||||
for k in keys:
|
||||
|
@ -59,7 +59,7 @@ class Slave(threading.Thread):
|
||||
class Master:
|
||||
def __init__(self, server):
|
||||
self.server = server
|
||||
self.masterq = None
|
||||
self.masterq = Queue.Queue()
|
||||
|
||||
def tick(self, q):
|
||||
try:
|
||||
@ -75,12 +75,10 @@ class Master:
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
q = Queue.Queue()
|
||||
self.masterq = q
|
||||
slave = Slave(q, self.server)
|
||||
slave = Slave(self.masterq, self.server)
|
||||
slave.start()
|
||||
while not exit:
|
||||
self.tick(q)
|
||||
self.tick(self.masterq)
|
||||
self.shutdown()
|
||||
|
||||
def handle(self, msg):
|
||||
|
Loading…
Reference in New Issue
Block a user