From e60860e65d06d2b4452b7ea94902d79eed11d78c Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Fri, 3 Jun 2016 12:06:36 +1200 Subject: Make tcp.Client.connect return a context manager that closes the connection --- pathod/pathoc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pathod') diff --git a/pathod/pathoc.py b/pathod/pathoc.py index 2b7d053c..5cfb4591 100644 --- a/pathod/pathoc.py +++ b/pathod/pathoc.py @@ -286,7 +286,7 @@ class Pathoc(tcp.TCPClient): if self.use_http2 and not self.ssl: raise NotImplementedError("HTTP2 without SSL is not supported.") - tcp.TCPClient.connect(self) + ret = tcp.TCPClient.connect(self) if connect_to: self.http_connect(connect_to) @@ -324,6 +324,7 @@ class Pathoc(tcp.TCPClient): if self.timeout: self.settimeout(self.timeout) + return ret def stop(self): if self.ws_framereader: -- cgit v1.2.3