mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
We no longer need to track clientconnections.
This commit is contained in:
parent
f3f8462ddc
commit
f3742f29da
@ -336,8 +336,6 @@ class Flow:
|
||||
|
||||
class State:
|
||||
def __init__(self):
|
||||
self.client_connections = []
|
||||
|
||||
self._flow_map = {}
|
||||
self._flow_list = []
|
||||
self.view = []
|
||||
@ -361,15 +359,6 @@ class State:
|
||||
c += 1
|
||||
return c
|
||||
|
||||
def clientconnect(self, cc):
|
||||
self.client_connections.append(cc)
|
||||
|
||||
def clientdisconnect(self, dc):
|
||||
"""
|
||||
Start a browser connection.
|
||||
"""
|
||||
self.client_connections.remove(dc.client_conn)
|
||||
|
||||
def add_request(self, req):
|
||||
"""
|
||||
Add a request to the state. Returns the matching flow.
|
||||
@ -634,11 +623,9 @@ class FlowMaster(controller.Master):
|
||||
#end nocover
|
||||
|
||||
def handle_clientconnect(self, r):
|
||||
self.state.clientconnect(r)
|
||||
r.ack()
|
||||
|
||||
def handle_clientdisconnect(self, r):
|
||||
self.state.clientdisconnect(r)
|
||||
r.ack()
|
||||
|
||||
def handle_error(self, r):
|
||||
|
@ -253,8 +253,6 @@ class uState(libpry.AutoTree):
|
||||
"""
|
||||
bc = proxy.ClientConnect(("address", 22))
|
||||
c = flow.State()
|
||||
c.clientconnect(bc)
|
||||
assert len(c.client_connections) == 1
|
||||
|
||||
req = tutils.treq(bc)
|
||||
f = c.add_request(req)
|
||||
@ -284,8 +282,6 @@ class uState(libpry.AutoTree):
|
||||
assert c.active_flow_count() == 0
|
||||
|
||||
dc = proxy.ClientDisconnect(bc)
|
||||
c.clientdisconnect(dc)
|
||||
assert not c.client_connections
|
||||
|
||||
def test_err(self):
|
||||
bc = proxy.ClientConnect(("address", 22))
|
||||
@ -302,7 +298,6 @@ class uState(libpry.AutoTree):
|
||||
c = flow.State()
|
||||
|
||||
req = tutils.treq()
|
||||
c.clientconnect(req.client_conn)
|
||||
assert len(c.view) == 0
|
||||
|
||||
f = c.add_request(req)
|
||||
@ -317,7 +312,6 @@ class uState(libpry.AutoTree):
|
||||
assert len(c.view) == 1
|
||||
|
||||
req = tutils.treq()
|
||||
c.clientconnect(req.client_conn)
|
||||
c.add_request(req)
|
||||
assert len(c.view) == 2
|
||||
c.set_limit("~q")
|
||||
@ -453,7 +447,6 @@ class uFlowMaster(libpry.AutoTree):
|
||||
assert not fm.handle_response(rx)
|
||||
|
||||
dc = proxy.ClientDisconnect(req.client_conn)
|
||||
fm.handle_clientdisconnect(dc)
|
||||
|
||||
err = proxy.Error(f.request, "msg")
|
||||
fm.handle_error(err)
|
||||
|
Loading…
Reference in New Issue
Block a user