summaryrefslogtreecommitdiff
path: root/lib/net
diff options
context:
space:
mode:
Diffstat (limited to 'lib/net')
-rw-r--r--lib/net/imap.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/net/imap.rb b/lib/net/imap.rb
index 64011e69cc..e6ffa3b1e0 100644
--- a/lib/net/imap.rb
+++ b/lib/net/imap.rb
@@ -288,11 +288,15 @@ module Net
# Disconnects from the server.
def disconnect
begin
- # try to call SSL::SSLSocket#io.
- @sock.io.shutdown
- rescue NoMethodError
- # @sock is not an SSL::SSLSocket.
- @sock.shutdown
+ begin
+ # try to call SSL::SSLSocket#io.
+ @sock.io.shutdown
+ rescue NoMethodError
+ # @sock is not an SSL::SSLSocket.
+ @sock.shutdown
+ end
+ rescue Errno::ENOTCONN
+ # ignore `Errno::ENOTCONN: Socket is not connected' on some platforms.
end
@receiver_thread.join
@sock.close