Skip to content

Commit 17b6463

Browse files
committed
🧵 Join the receiver _after_ closing the socket
The reciever thread should close the connection before it finishes, and `@sock.shutdown` should've been enough to trigger that. But this ensures the socket is closed right away, without needing to wait on whatever the receiver thread might be in the middle of doing.
1 parent 4d13606 commit 17b6463

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/net/imap.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,10 +1148,10 @@ def disconnect
11481148
rescue Exception => e
11491149
@receiver_thread.raise(e)
11501150
end
1151-
@receiver_thread.join
11521151
synchronize do
11531152
@sock.close
11541153
end
1154+
@receiver_thread.join
11551155
raise e if e
11561156
ensure
11571157
# Try again after shutting down the receiver thread. With no reciever

0 commit comments

Comments
 (0)