diff options
Diffstat (limited to 'libmproxy/proxy.py')
-rw-r--r-- | libmproxy/proxy.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 79025a34..df810da5 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -82,14 +82,15 @@ class ServerConnection(tcp.TCPClient): self.wfile.flush() def terminate(self): - try: - self.wfile.flush() - except IOError: # pragma: no cover - pass - try: - self.connection.close() - except IOError: - pass + if self.connection: + try: + self.wfile.flush() + except IOError: # pragma: no cover + pass + try: + self.connection.close() + except IOError: + pass |