diff options
Diffstat (limited to 'libmproxy/protocol')
| -rw-r--r-- | libmproxy/protocol/http.py | 8 | 
1 files changed, 8 insertions, 0 deletions
diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py index fc045e0d..8315aed0 100644 --- a/libmproxy/protocol/http.py +++ b/libmproxy/protocol/http.py @@ -135,6 +135,11 @@ class SafeH2Connection(H2Connection):          self.conn = conn          self.lock = threading.RLock() +    def safe_close_connection(self, error_code): +        with self.lock: +            self.close_connection(error_code) +            self.conn.send(self.data_to_send()) +      def safe_increment_flow_control(self, stream_id, length):          with self.lock:              self.increment_flow_control_window(length) @@ -263,6 +268,9 @@ class Http2Layer(Layer):                          source_conn.h2.safe_acknowledge_settings(event)                          new_settings = dict([(id, cs.new_value) for (id, cs) in event.changed_settings.iteritems()])                          other_conn.h2.safe_update_settings(new_settings) +                    elif isinstance(event, ConnectionTerminated): +                        other_conn.h2.safe_close_connection(event.error_code) +                        return              # TODO: cleanup resources once we are sure nobody needs them              # for stream_id in self.streams.keys():  | 
