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.onekey = False
|
||||||
self.view_connlist()
|
self.view_connlist()
|
||||||
|
|
||||||
|
self.masterq = Queue.Queue()
|
||||||
|
slave = controller.Slave(self.masterq, self.server)
|
||||||
|
slave.start()
|
||||||
|
|
||||||
self.ui.run_wrapper(self.loop)
|
self.ui.run_wrapper(self.loop)
|
||||||
# If True, quit just pops out to connection list view.
|
# If True, quit just pops out to connection list view.
|
||||||
print >> sys.stderr, "Shutting down..."
|
print >> sys.stderr, "Shutting down..."
|
||||||
@ -1294,16 +1298,12 @@ class ConsoleMaster(flow.FlowMaster):
|
|||||||
return size
|
return size
|
||||||
|
|
||||||
def loop(self):
|
def loop(self):
|
||||||
q = Queue.Queue()
|
|
||||||
self.masterq = q
|
|
||||||
slave = controller.Slave(q, self.server)
|
|
||||||
slave.start()
|
|
||||||
try:
|
try:
|
||||||
while not controller.exit:
|
while not controller.exit:
|
||||||
startloop = time.time()
|
startloop = time.time()
|
||||||
self.statusbar.redraw()
|
self.statusbar.redraw()
|
||||||
size = self.drawscreen()
|
size = self.drawscreen()
|
||||||
self.tick(q)
|
self.tick(self.masterq)
|
||||||
self.ui.set_input_timeouts(max_wait=0.1)
|
self.ui.set_input_timeouts(max_wait=0.1)
|
||||||
keys = self.ui.get_input()
|
keys = self.ui.get_input()
|
||||||
for k in keys:
|
for k in keys:
|
||||||
|
@ -59,7 +59,7 @@ class Slave(threading.Thread):
|
|||||||
class Master:
|
class Master:
|
||||||
def __init__(self, server):
|
def __init__(self, server):
|
||||||
self.server = server
|
self.server = server
|
||||||
self.masterq = None
|
self.masterq = Queue.Queue()
|
||||||
|
|
||||||
def tick(self, q):
|
def tick(self, q):
|
||||||
try:
|
try:
|
||||||
@ -75,12 +75,10 @@ class Master:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
q = Queue.Queue()
|
slave = Slave(self.masterq, self.server)
|
||||||
self.masterq = q
|
|
||||||
slave = Slave(q, self.server)
|
|
||||||
slave.start()
|
slave.start()
|
||||||
while not exit:
|
while not exit:
|
||||||
self.tick(q)
|
self.tick(self.masterq)
|
||||||
self.shutdown()
|
self.shutdown()
|
||||||
|
|
||||||
def handle(self, msg):
|
def handle(self, msg):
|
||||||
|
Loading…
Reference in New Issue
Block a user