This is an automated email from the ASF dual-hosted git repository.
jking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git
The following commit(s) were added to refs/heads/master by this push:
new 638c91f THRIFT-1549: properly unwrap and close TSSLSocket in python
638c91f is described below
commit 638c91f6be6e4417f0d5d8d57886c9b74afabfbd
Author: James E. King III <[email protected]>
AuthorDate: Sat Jan 26 10:33:04 2019 -0500
THRIFT-1549: properly unwrap and close TSSLSocket in python
---
lib/py/src/transport/TSSLSocket.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lib/py/src/transport/TSSLSocket.py
b/lib/py/src/transport/TSSLSocket.py
index b54ca5d..00d1f10 100644
--- a/lib/py/src/transport/TSSLSocket.py
+++ b/lib/py/src/transport/TSSLSocket.py
@@ -263,6 +263,15 @@ class TSSLSocket(TSocket.TSocket, TSSLBase):
TSSLBase.__init__(self, False, host, kwargs)
TSocket.TSocket.__init__(self, host, port, unix_socket)
+ def close(self):
+ try:
+ self.handle.settimeout(0.001)
+ self.handle = self.handle.unwrap()
+ except (ssl.SSLError, socket.error, OSError):
+ # could not complete shutdown in a reasonable amount of time.
bail.
+ pass
+ TSocket.TSocket.close(self)
+
@property
def validate(self):
warnings.warn('validate is deprecated. please use cert_reqs instead',