aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/tcp.py
diff options
context:
space:
mode:
Diffstat (limited to 'netlib/tcp.py')
-rw-r--r--netlib/tcp.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/netlib/tcp.py b/netlib/tcp.py
index 31e9a398..c632ec67 100644
--- a/netlib/tcp.py
+++ b/netlib/tcp.py
@@ -235,6 +235,7 @@ class TCPClient:
try:
if self.ssl_established:
self.connection.shutdown()
+ self.connection.sock_shutdown(socket.SHUT_WR)
else:
self.connection.shutdown(socket.SHUT_WR)
#Section 4.2.2.13 of RFC 1122 tells us that a close() with any pending readable data could lead to an immediate RST being sent.
@@ -302,6 +303,8 @@ class BaseHandler:
if request_client_cert:
def ver(*args):
self.clientcert = certutils.SSLCert(args[1])
+ # Return true to prevent cert verification error
+ return True
ctx.set_verify(SSL.VERIFY_PEER, ver)
self.connection = SSL.Connection(ctx, self.connection)
self.ssl_established = True
@@ -338,6 +341,7 @@ class BaseHandler:
try:
if self.ssl_established:
self.connection.shutdown()
+ self.connection.sock_shutdown(socket.SHUT_WR)
else:
self.connection.shutdown(socket.SHUT_WR)
#Section 4.2.2.13 of RFC 1122 tells us that a close() with any pending readable data could lead to an immediate RST being sent.
@@ -376,7 +380,13 @@ class TCPServer:
self.__is_shut_down.clear()
try:
while not self.__shutdown_request:
- r, w, e = select.select([self.socket], [], [], poll_interval)
+ try:
+ r, w, e = select.select([self.socket], [], [], poll_interval)
+ except select.error, ex:
+ if ex[0] == 4:
+ continue
+ else:
+ raise
if self.socket in r:
request, client_address = self.socket.accept()
t = threading.Thread(