diff options
author | VinayGValsaraj <vinaygvalsaraj@gmail.com> | 2021-12-10 17:15:41 -0600 |
---|---|---|
committer | Asif Saif Uddin <auvipy@gmail.com> | 2021-12-12 10:42:09 +0600 |
commit | d4c879f03e84e00bad9bd54cb8bf3c8b18bcd0f6 (patch) | |
tree | 0f367981e3a2b555b2a97c5e1e124aacc0508ed8 /amqp/transport.py | |
parent | 1cf468ce3ff0da2dc835daff269110032c16310c (diff) | |
download | py-amqp-d4c879f03e84e00bad9bd54cb8bf3c8b18bcd0f6.tar.gz |
Adding two tests, for Connection.collect and Transport.close.
Diffstat (limited to 'amqp/transport.py')
-rw-r--r-- | amqp/transport.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/amqp/transport.py b/amqp/transport.py index 701c34c..177fb22 100644 --- a/amqp/transport.py +++ b/amqp/transport.py @@ -276,7 +276,10 @@ class _AbstractTransport: # Call shutdown first to make sure that pending messages # reach the AMQP broker if the program exits after # calling this method. - self.sock.shutdown(socket.SHUT_RDWR) + try: + self.sock.shutdown(socket.SHUT_RDWR) + except OSError: + pass self.sock.close() self.sock = None self.connected = False @@ -525,8 +528,8 @@ class SSLTransport(_AbstractTransport): context.load_verify_locations(ca_certs) if ciphers is not None: context.set_ciphers(ciphers) - # Set SNI headers if supported. - # Must set context.check_hostname before setting context.verify_mode + # Set SNI headers if supported. + # Must set context.check_hostname before setting context.verify_mode # to avoid setting context.verify_mode=ssl.CERT_NONE while # context.check_hostname is still True (the default value in context # if client-side) which results in the following exception: @@ -539,7 +542,7 @@ class SSLTransport(_AbstractTransport): except AttributeError: pass # ask forgiveness not permission - # See note above re: ordering for context.check_hostname and + # See note above re: ordering for context.check_hostname and # context.verify_mode assignments. if cert_reqs is not None: context.verify_mode = cert_reqs |