Commit 642203eb authored by anonym's avatar anonym
Browse files

tor-controlport-filter: deal with unlikely race.

parent 5d813373
......@@ -152,7 +152,12 @@ class FilteredControlPortProxyHandler(socketserver.StreamRequestHandler):
return controller
def handle(self):
client_conn = next(conn for conn in psutil.net_connections() if conn.laddr == self.client_address)
try:
client_conn = next(conn for conn in psutil.net_connections() if conn.laddr == self.client_address)
except StopIteration:
# Deal with the race between looking up the PID, and the
# client being killed before we find the PID.
return
client_exe_path = exe_path_of_pid(client_conn.pid)
try:
client_filter = next(filter for filter in self.filters if any(exe_path for exe_path in filter['match-exe-paths'] if client_exe_path == exe_path))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment