Interrupt interception when deleting an intercepting flow.

Prompting the user for this is annoying.
This commit is contained in:
Aldo Cortesi 2011-03-15 17:53:29 +13:00
parent e3ad3790de
commit 394bd1d6b0
3 changed files with 8 additions and 20 deletions

View File

@ -139,10 +139,6 @@ class ConnectionItem(WWrap):
w = self.get_text()
WWrap.__init__(self, w)
def intercept(self):
self.intercepting = True
self.w = self.get_text()
def get_text(self):
return urwid.Text(format_flow(self.flow, self.focus))
@ -159,8 +155,8 @@ class ConnectionItem(WWrap):
elif key == "C":
self.master.clear_connections()
elif key == "d":
if not self.state.delete_flow(self.flow):
self.master.statusbar.message("Can't delete connection mid-intercept.")
self.flow.kill(self.master)
self.state.delete_flow(self.flow)
self.master.sync_list_view()
elif key == "r":
r = self.master.replay_request(self.flow)
@ -178,7 +174,7 @@ class ConnectionItem(WWrap):
self.flow
)
elif key == "z":
self.master.kill_connection(self.flow)
self.flow.kill(self.master)
elif key == "enter":
if self.flow.request:
self.master.view_flow(self.flow)
@ -1416,9 +1412,6 @@ class ConsoleMaster(flow.FlowMaster):
self.state.delete_flow(f)
self.sync_list_view()
def kill_connection(self, f):
f.kill(self)
def refresh_connection(self, c):
if hasattr(self.header, "refresh_connection"):
self.header.refresh_connection(c)

View File

@ -293,8 +293,8 @@ class Flow:
self.request.ack(None)
elif self.response and not self.response.acked:
self.response.ack(None)
self.intercepting = False
master.handle_error(self.error)
self.intercepting = False
def intercept(self):
self.intercepting = True
@ -403,12 +403,10 @@ class State:
return tuple(self.flow_list[:])
def delete_flow(self, f):
if not f.intercepting:
if f.request in self.flow_map:
del self.flow_map[f.request]
self.flow_list.remove(f)
return True
return False
def clear(self):
for i in self.flow_list[:]:

View File

@ -325,9 +325,6 @@ class uState(libpry.AutoTree):
f = self._add_request(c)
f.intercepting = True
c.clear()
assert c.flow_count() == 1
f.intercepting = False
c.clear()
assert c.flow_count() == 0